+ 3
Can someone help me?
https://code.sololearn.com/cqA5nYKQVaQH/?ref=app I keep getting attribute error :(
3 odpowiedzi
+ 8
If you import with *, you import every name from a module.
This means, you have to write 'choice' instead of 'random.choice'.
+ 3
you kind of got Java like syntax when you imported random ...
importing random like this gives no error:
import random
+ 2
from random import *
#listes
salut = ("Bonjour","Enchenté","Salut","Coucou mon chou","Hé")
prenom = ("Philipe","Pierre","Mohamed","Mamadou","Patrique","Claude")
aimpa = ("j'adore","je hais","je t'aime autant que j'aime","j'aime bien","je deteste","je n'aprecie guere","j'aime pas","j'aprecie")
truc = ("ma belle mère","le karate","le chocolat","le cassoulet","les arabes","ma femme","le foot","ton visage")
adj = ("bizarre","etrange","hideux","beau","mignifique","a vomir","effrayant")
#aléatoire
text1 = choice(salut)
text2 = choice(prenom)
text3 = choice(aimpa)
text4 = choice(truc)
text5 = choice(adj)
#texte
print(text1 + ", tu t'appelles " + text2 + " c'est ça? Tu sais, moi, " + text3 + " " + text4 + ", ce truc est " + text5)
## paste this code..
## if you have written import random
## then you use random.choice
## if you have written from random import choice or *
## then u use only choice