Reputation: 1
I have been trying to build a randomized greeting program, so far I got:
import random
a = ("Hi!", "How are you?", "You Good?")
b = random.choice(a)
print(b)
It used to work, but now it just says that there are no attributes for .choice, can someone help?
Edit1: I think my Python is broken...
Edit2: Wait it's fixed now...
Upvotes: 0
Views: 53
Reputation: 7150
Your code is correct. Here are some step to refine or rebuild you code:
random.choice(a)
. 'a'
should be a List, Tuple, or String
only.[]
instead of small bracket ()
. Like a = ["Hi!", "How are you?", "You Good?"]
Upvotes: 0