Convert Asciidoc to markdown
Converted asciidoc to markdown using ai.
This commit is contained in:
@ -1,17 +1,15 @@
|
||||
= Exercices
|
||||
# Exercices
|
||||
|
||||
== Exercice 1
|
||||
## Exercice 1
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
print("La rue Rostand,")
|
||||
print(" se trouve au")
|
||||
print("Feu à droite")
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice 2
|
||||
## Exercice 2
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
print("Haut", "les", "cœurs", "!")
|
||||
----
|
||||
```
|
@ -1,57 +1,51 @@
|
||||
= Exercices
|
||||
# Exercices
|
||||
|
||||
== Exercice 1
|
||||
## Exercice 1
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
prenom = "Paul"
|
||||
temperature = 24.8
|
||||
paul_age = 30
|
||||
print(prenom, temperature, paul_age)
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice 2
|
||||
## Exercice 2
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
saisie = input("Saisissez du texte :")
|
||||
print(saisie)
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice 3
|
||||
## Exercice 3
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
val1 = 53 * 46 + 13
|
||||
val2 = 99 > 13
|
||||
val3 = "Bonjour " + "chef"
|
||||
val4 = (59 * 62 + 13) / 6.5
|
||||
print(val1, val2, val3, val4)
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice A1
|
||||
## Exercice A1
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
distance = 42195
|
||||
print(distance // 1000) # nombre de kilomètres
|
||||
print(distance % 1000) # nombre de mètres restants
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice A2
|
||||
## Exercice A2
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
weight = 4_502_177
|
||||
print(weight // 1000000, "tonnes") # combien de groupes de 1000000 de grammes
|
||||
print((weight // 1000) % 1000) # combien de kilos restants, sans compter les tonnes
|
||||
print(weight % 1000) # combien de grammes restants
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice A3
|
||||
## Exercice A3
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
saisie1 = input("Premier nombre :") # attention, je vais récupérer du texte
|
||||
saisie2 = input("Second nombre :")
|
||||
saisie1 = float(saisie1) # convertir en flottant
|
||||
@ -62,4 +56,4 @@ else:
|
||||
print(saisie2)
|
||||
# Autre possibilité intéressante
|
||||
print(max(saisie1, saisie2))
|
||||
----
|
||||
```
|
@ -1,38 +1,34 @@
|
||||
= Exercices
|
||||
# Exercices
|
||||
|
||||
== Exercice 1
|
||||
## Exercice 1
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
roll = 5
|
||||
if roll > 4:
|
||||
print("Lancer réussi !")
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice 2
|
||||
## Exercice 2
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
text = "Bonjour"
|
||||
if text == "bonjouR":
|
||||
print("Bien le bonjour")
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice 2B
|
||||
## Exercice 2B
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
text = "Bonjour"
|
||||
if text == "Bonjour":
|
||||
print("Bien le bonjour")
|
||||
else:
|
||||
print("Je ne comprends pas !")
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice 3
|
||||
## Exercice 3
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
value = 7
|
||||
if value >= 9:
|
||||
print("Élevé")
|
||||
@ -42,36 +38,33 @@ elif value >= 4:
|
||||
print("Standard")
|
||||
else:
|
||||
print("Bas")
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice A1
|
||||
## Exercice A1
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
a1 = 4
|
||||
a2 = 7
|
||||
if a1 > 5 and a2 < 6:
|
||||
print("OK")
|
||||
else:
|
||||
print("Valeurs incorrectes")
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice A2
|
||||
## Exercice A2
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
a1 = 5
|
||||
a2 = 5
|
||||
if a1 > 5 or a2 < 6:
|
||||
print("Conditions suffisantes")
|
||||
else:
|
||||
print("Valeurs incorrectes")
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice A3
|
||||
## Exercice A3
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
is_on = True
|
||||
saisie = input("Saisissez une commande (Marche ou Arrêt) :")
|
||||
if saisie == "Marche":
|
||||
@ -84,5 +77,4 @@ elif saisie == "Arrêt":
|
||||
print("Extinction…")
|
||||
else:
|
||||
print("Déjà éteint !")
|
||||
----
|
||||
|
||||
```
|
@ -1,27 +1,24 @@
|
||||
= Exercices
|
||||
# Exercices
|
||||
|
||||
== Exercice 1
|
||||
## Exercice 1
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
for number in range(10):
|
||||
print(number)
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice 2
|
||||
## Exercice 2
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
for number in range(10):
|
||||
if number % 2 == 0: # Est pair / reste 0 quand on fait la division entière
|
||||
print(number)
|
||||
----
|
||||
```
|
||||
|
||||
== Exercice A1
|
||||
## Exercice A1
|
||||
|
||||
[source, python]
|
||||
----
|
||||
```python
|
||||
for item1 in range(10):
|
||||
for item2 in range(item1):
|
||||
print(item1, item2)
|
||||
----
|
||||
```
|
@ -1,14 +1,10 @@
|
||||
= Exercices sur les dictionnaires
|
||||
# Exercices sur les dictionnaires
|
||||
|
||||
'''
|
||||
## Exercice A1 : compréhension de dictionnaire
|
||||
|
||||
== Exercice A1 : compréhension de dictionnaire
|
||||
*Rappel* : Convertir un dictionnaire en gardant les clés originales, mais y associer comme valeurs uniquement les températures.
|
||||
|
||||
*Rappel* : Convertir un dictionnaire en gardant les clés originales,
|
||||
mais y associer comme valeurs uniquement les températures.
|
||||
|
||||
[source,python]
|
||||
----
|
||||
```python
|
||||
# Dictionnaire original
|
||||
meteo = {
|
||||
"Pau": (21.0, "Nuageux", 1015),
|
||||
@ -23,4 +19,4 @@ meteo = {
|
||||
converted = {key: meteo[key][0] for key in meteo}
|
||||
# On affiche le résultat pour le vérifier
|
||||
print(converted)
|
||||
----
|
||||
```
|
Reference in New Issue
Block a user