isdecimal0 replace (old substring,new substring) lowe find(substring) Exercise 2
ID: 3848868 • Letter: I
Question
isdecimal0 replace (old substring,new substring) lowe find(substring) Exercise 2: write a program called time py that prompts the user to enter the current time in HH MM format, and then prints a message that states the time in a sentence. What is the time please (HH:MM) 06:55 Thanks! It is now 55 minutes after 06 o'clock. For example, a sample run of your program might look something like this: Exercise 3: Write a code that prompts the user to enter a 8-character string, and then prints the first, fourth, and eighth letters of that string. A sample run of your code might look like this: Please enter your 8 characters string PAsswoRDExplanation / Answer
time.py
time = input('What is the time please (HH:MM)?')
print("Thanks! It is now {1} minutes after {0} o' clock".format(time[:2],time[3:]))
# the fomat method is used along with the string to format it , format contains a tuple of arguments that are to be placed in the string at positions specified by { } with the tuple value specified in between { n } where n is the index of value inside the tuple
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.