mardi 11 octobre 2022

How do I use the .random module on a list to get a random item out without using .choice?

I'm a total begginer in programming :)

I'm trying to solve a coding challange which instructs me to pick a random name out of a list but i'm not allowed to use the .choice function instead I somehow need to pick an item out using the len() function in my code.

# Split string method
names_string = input("Give me everybody's names, separated by a comma. ")
names = names_string.split(", ")
# 🚹 Don't change the code above 👆

#Write your code below this line 👇
import random



Aucun commentaire:

Enregistrer un commentaire