Saori Yoshimoto work notes since 2018

Wednesday, April 29, 2020

[Python] random function

import random

names = ['apple', 'orenge', 'banana', 'pineapple', 'lemon']

random_number = random.randint(0,len(names)-1)
chosen_one    = names[random_number]
print(chosen_one)

No comments:

Post a Comment