0

How can I resolve the program to randomly select from the specified texts?

Example: Texts to choose from: "Hello";"Bye";"Goodbye" Output: Hello

11th Oct 2020, 11:05 AM
Royalx
Royalx - avatar
3 Answers
0
Try this import random as r lst=['Hello','Bye','Goodbye'] print(lst[r.randint(0,len(lst))])
11th Oct 2020, 11:18 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
+ 6
use random.choice(<iterable>)
11th Oct 2020, 11:18 AM
Slick
Slick - avatar
+ 1
Thank you guys!! 😁
11th Oct 2020, 11:22 AM
Royalx
Royalx - avatar