Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

python 3. Complete the function calculate_minutes below so that given an amount of time specified in hours and minutes, the function returns the total number

python

image text in transcribed

image text in transcribed

3. Complete the function calculate_minutes below so that given an amount of time specified in hours and minutes, the function returns the total number of minutes (e.g. given 3 hours and 15 minutes, it should return 195 minutes) 4. Complete the function number_okay which takes a string as input and returns True if the string is the name of one of the numbers 15 (i.e. "one", "two", "three", "four", "five"), and False otherwise. You can assume that the string given to number_okay is all lowercase letters. def number_okay(num_string): \# write your code here print(number_okay("three")) print(number_okay("eleven")) 5. Write a function calculate_hours_or_minutes that takes three arguments hours, minutes, and time_format . If the value of time_format is "minutes", the function should do the same thing as calculate_minutes above. Otherwise if the value of time_format is "hours", it should return fractional number of hours that the sum of hours and minutes represents. Eg. calculate_hours_or_minutes(3,15, "hours") should return 3.25. def calculate_hours_or_minutes(hours, minutes, time_format): \# write your code here print(calculate_hours_or_minutes( 3,15 , "minutes")) print(calculate_hours_or_minutes( 3,15 , "hours"))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions