Aug-14-2020, 02:10 PM
(This post was last modified: Aug-14-2020, 02:12 PM by rachelscott.)
Hello! I am very new to Python. I am trying to create a program that takes user input for the number of exercises and types of exercises and returns a random sample from the respective list. However the output I get does not print out the random sample of exercises. I am not sure what I am doing wrong or how to make the final random sample print out. Any help is greatly appreciated!
from random import sample Upper_List=['25 push ups', '12 shoulder press ups', '12 tricep dips'] Lower_List= ['25 jump squats', '25 calf raises', '20 lunges'] Full_Body_List = ['25 push ups', '25 jump squats', '12 shoulder press ups', '20 leg lifts', '25 calf raises', '20 lunges'] number = int(input('Number of Exercises:')) workout_type=input("Upper, Lower, or Full Body?") if workout_type == "Upper": print(sample(Upper_List, number)) elif workout_type == 'Lower': print(sample(Lower_List, number)) elif workout_type=="Full Body": print(sample(Full_Body_List, number))OUTPUT:
Number of Exercises: 3 Upper, Lower, or Full Body? Upper [Finished in 4.28s]