L

@LD77

alphabet

Python
5 months ago
alphabet = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" for i in alphabet: print(i)

choice liste python

Python
5 months ago
import random liste = [2,5,"machin",25] maliste = random.choice(liste) print(maliste)

uniform python decimal

Python
5 months ago
import random r = random.uniform(0,1) print(r)

randint

Python
5 months ago
import random r = random.randint(0,10) print(r)

hash python

Python
5 months ago
machin = "Je m'appelle loic" truc = hash(machin) print(truc)

format loic

Python
5 months ago
age=22 prenom = "Loic" phrase = "J'ai {0} ans et je m'appelle {1}".format(age,prenom) print(phrase)

python poo

Python
5 months ago
class Personne: def __init__(self, nom, prenom, age, taille): self.nom = nom self.prenom = prenom self.age = age self.taille = taille def showtaille(self): return self.taille

mettre un mot en majuscule

Python
5 months ago
mot = 'banane' test = mot.upper() print(test)

afficher si une lettre est présent dans un mot

Python
5 months ago
mot = 'loic' index = mot.find('u') index2 = mot.find('o') print(index) print(index2)

afficher chaque lettre individuellement dans une chaîne de caractère

Python
5 months ago
mot ='Hello world!' for i in mot: print(i)

afficher une partie d'une chaîne de caractere en python

Python
5 months ago
a = 'Hello world!' print(a[0:3])

Supprimer un élément d une liste python

Python
5 months ago
li = [9, "machin", 22] li.pop(0) print(li)

Ajouter un élément à une liste

Python
5 months ago
li= [6,9,15] li.append("loic") print(li)

Parcourir une liste

Python
5 months ago
li = [5, "machin", 22, "bidule"] li.append("loic") for i in range(0,len(li)): print(li[i])