import random
user input
n = int(input("Enter number of elements : ")) lst = list(map(int, input("\nEnter the numbers : ").strip().split()))[:n] print("\nList is - ", lst) print(random.choice(lst))
Many languages contain classes that allow for the functionality of a random number generator
import random
n = int(input("Enter number of elements : ")) lst = list(map(int, input("\nEnter the numbers : ").strip().split()))[:n] print("\nList is - ", lst) print(random.choice(lst))
Log in or sign up for Devpost to join the conversation.