diff --git a/python/1/ex22.py b/python/1/ex22.py new file mode 100755 index 0000000..1d40b7e --- /dev/null +++ b/python/1/ex22.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +# consonnes = ['a', 'e', 'i', 'o', 'u', 'y'] + +cpt = 0 +phrase = input("Ecrire une phrase : ") +for i in phrase: + if i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u' or i == 'y': + cpt = cpt + 1 + +print("Il y a", cpt, "consonnes dans la phrase: ", phrase) \ No newline at end of file diff --git a/python/1/ex2c.py b/python/1/ex2c.py new file mode 100755 index 0000000..8e740c1 --- /dev/null +++ b/python/1/ex2c.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +note = int(input("Entrer une note [entre 0 et 20] : ")) +mention = "" + +if (note >= 10) and (note < 12): + mention = "Passable" + print ("La note ", note, "correspond à la mention ", mention) +elif (note >=12) and (note < 14): + mention = "Assez Bien" + print ("La note ", note, "correspond à la mention ", mention) +elif note>=14 and note < 16: + mention = "Bien" + print ("La note ", note, "correspond à la mention ", mention) +elif note >= 16: + mention = "Très Bien" + print ("La note ", note, "correspond à la mention ", mention) diff --git a/python/1Prog.md b/python/1Prog.md index 18ada3a..b94594a 100644 --- a/python/1Prog.md +++ b/python/1Prog.md @@ -13,7 +13,7 @@ Syntaxe Sémantique opérationnelle Sémantique dénotationnelle -``` +```python for i in (1 .. 100): print ("Je ne lance plus d'avion dans la classe") ``` diff --git a/python/3/books.csv b/python/3/books.csv new file mode 100644 index 0000000..63db55c --- /dev/null +++ b/python/3/books.csv @@ -0,0 +1,6 @@ +, Book, Author, Year Released +0, To Kill A Mockingbird,Harper Lee, 1960 +1, A Brief History of Time, Stephen Hawking, 1988 +2, The Great Gatsby , F. Scott Fitzgerald, 1922 +3, The Man Who Mistook His Wife for a Hat, Oliver Sacks, 1985 +4, Pride and Prejudice , Jane Austen , 1813 diff --git a/python/3/books.py b/python/3/books.py new file mode 100644 index 0000000..9e32e99 --- /dev/null +++ b/python/3/books.py @@ -0,0 +1,3 @@ +file = open("books.csv","r") +for row in file: + print(row[3]) diff --git a/python/3/exoW3.py b/python/3/exoW3.py new file mode 100644 index 0000000..0c7824c --- /dev/null +++ b/python/3/exoW3.py @@ -0,0 +1,8 @@ +num = int (input("Entrer un nombre entre 10 et 20 (compris): ")) +while num <= 10 or num >= 20: + if num < 10: + print("Trop faible") + else: + print("Trop élevé") + num = int(input("Recommencer: ")) +print("Merci!")