mardi 13 juillet 2021

Beginner issue with random.choice

I am just starting to try to learn python. I am a teacher and hoping that by learning python I can eventually code some tasks that will be useful in the classroom. I want to create a list of students for each class, and then be able to randomly select a student. I’ve searched online to try to understand why this is not working and can’t figure it out. I’m sure it’s a silly error, but I would appreciate any help making sense of this.

import random

period1 = ['bern', 'brian', 'molly', 'pizza', 'dave', 'deena', 'tom', 'kelly']

period2 = ['bob', 'shane', 'marge', 'frank', 'Becky ', 'Delilah ', 'Teddy', 'Hudson']

random_student = input('Which class needs a volunteer?')

print(random.choice(random_student))



Aucun commentaire:

Enregistrer un commentaire