+ 3

Can someone help me?

https://code.sololearn.com/cqA5nYKQVaQH/?ref=app I keep getting attribute error :(

6th Aug 2019, 12:42 PM
GreeFoss XD
GreeFoss XD - avatar
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'.
6th Aug 2019, 1:30 PM
HonFu
HonFu - avatar
+ 3
you kind of got Java like syntax when you imported random ... importing random like this gives no error: import random
6th Aug 2019, 12:45 PM
Anton Böhler
Anton Böhler - avatar
+ 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
6th Aug 2019, 1:58 PM
sayan chandra
sayan chandra - avatar