Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2C1 #31

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

P2C1 #31

Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion P1/P1C6/énoncé/main.py
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# Écrivez votre code ici !
# Écrivez votre code ici !

# Instructions

# 1. **Créez** une liste nommée `fruits` contenant les éléments `"pomme"`, `"banane"` et `"orange"`.
fruits = ["pomme", "banane", "orange"]
# 2. **Ajoutez** `"kiwi"` à la liste `fruits`.
fruits.append("kiwi")
# 3. **Supprimez** `"orange"` de la liste `fruits`.
fruits.remove("orange")
# 4. **Modifiez** le **deuxième** élément de la liste `fruits` en `"ananas"`.
fruits[1] = "ananas"
# 5. **Affichez** la **longueur** de la liste `fruits`.
print(f"Longueur de la liste fruits: {len(fruits)}.")
# 6. **Triez** la liste `fruits` par ordre alphabétique
fruits.sort()
# 7. **Affichez** la liste. *(N'oubliez pas d'afficher la liste pour que les tests passent)*
print(fruits)