![]() ![]() 9 10 11 12 13 Problem 2 14 #TODO: Teport the random module 15 16 #TODO: Ask the user for the seed and then set the random seed value using the seed() function from the randon module 17 y - input() #even if you start with question 3, leave this input() call here so that the lab can be graded correctly 18 #you can of course rename the variable to whatever makes sense for your code. The user will input the list length and all of the elements in the list Ex: If the input is bob peanut 7 bob the output is How many elements will you have in your initial list? 4 What would you like to add to the list? bob What would you like to add to the list? peanut What would you like to add to the list? 7 uld you like to add to the list?Ģ #TODO: Ask the user for the time they want to convert fron military time 3 X - input() #even if you don't do this problem first, make sure you leave the input() call here so that the lab can be graded 4 you can of course rename the variable to whatever makes sense for your code it does not have to stay 5 6 7 TODO: Convert the time to a 12 hour scale and print it out for the user 8. Use this input value to set the seed value before randomly selecting a greeting from the list provided and printing it out to the user Ex If the input isĮX If the input is 900 the output is: What seed value would you like to use? 900 Hey there Problem 3: Unique Entries You will ask the user to define a fixed length list of elements (you may assume all entries in the list will be strings) and then print out a sorted list of the unique entries. Ask the user first to input a seed value. Problem 2: Random Greeting Import the random module to use the seed and other module functions. Ex If the input is 16 the output is What time would you like to convert from military time? 16 16 in military time converts to 4pm on a 12 hour clock. Military Time (midnight) 4 12 (noon) 15 24 (midnight) 12-Hour Clock 12 am 4 am 12pm 3pm 12 am You will need to ask the user what time they would like to convert, and then print out a statement telling them what time it is according to a 12 hour clock. Some sample time pairings are provided below. For example, thirty minutes after eight in the morning is written 0830, and pronounced "oh eight thirty" hours.Problem 1: Military Time Converter You will write a military to 12 hour converter You only need to work with hours, no minutes will be given Military time is on a 24 hour clock instead of 12. Include a leading zero before a single digit hour.For example, write "fourteen hundred thirty" hours as 1430 (equivalent to 2:30 PM in standard time). Always write military time as four digits, two for the hour and two for the minutes.Neither AM nor PM is used to designate the period of the day.No colon should stand between the hour and the minutes.These are generally capitalized in more formal contexts, with or without periods, but the lower case equivalent is usually acceptable otherwise.įor example, you would write one minute past two o'clock in the morning as 2:01 AM. The time should always be followed by AM or PM to designate it as before or after noon.Write the time with a colon between the hour and the minutes.For both clocks, be careful to understand how to write the times of day in their proper formats.
0 Comments
Leave a Reply. |