I have read other posts about the topic, but none have seemed to work for me. I'm getting an error:
TypeError: calcs() missing 3 required positional arguments: 'hrs', 'mins', and 'secs'
When I try to pass these three variables into calcs():
The purpose of the code is to see at what degrees are each of the hands on the clock at (relative to 12:00:00).
def input_io():
input_time = input("Please enter the time following the HH:MM:SS format - be sure to include all colons and zeros needed. (e.g. 3:45:22 should be input as 03:45:22).")
bool_okinput = False
while bool_okinput != True:
if ':' not in input_time:
input_time = input("Missing Colon - Please check the format (HH:MM:SS) and re-enter the time.")
elif len(input_time) != 8:
input_time = input("Too Many/Too Few Characters - Please check the format (HH:MM:SS) and re-enter the time.")
else:
while bool_okinput != True:
input_time = input_time.split(":")
hrs = int(input_time[0])
mins = int(input_time[1])
secs = int(input_time[2])
if hrs > 12:
input_time = input(
"Hours is greater than 12 - Please check the format (HH:MM:SS) and re-enter the time.")
elif mins > 59:
input_time = input(
"Minutes is greater than 59 - Please check the format (HH:MM:SS) and re-enter the time.")
elif secs > 59:
input_time = input(
"Seconds is greater than 59 - Please check the format (HH:MM:SS) and re-enter the time.")
else:
bool_okinput = True
return [hrs, mins, secs]
inputs = input_io()
hrs = inputs[0]
mins = inputs[1]
secs = inputs[2]
def calcs(hrs, mins, secs):
degree_mult = 360/60
hrs_degree_mult = 360/12
if hrs == 12:
hrs = 1
degrees_secs = (secs * degree_mult)
degrees_mins = (mins * degree_mult)+(degrees_secs / 60)
degrees_hrs = (hrs * hrs_degree_mult)+(degrees_mins / 60)+(degrees_secs / (60^2))
return [degrees_hrs, degrees_mins, degrees_secs]
degrees = calcs()
degrees_hrs = degrees[0]
degrees_mins = degrees[1]
degrees_secs = degrees[2]
print(f"When the Time is: {hrs}:{mins}:{secs}")
print(f"Hour Hand Degrees: {degrees_hrs}")
print(f"Minute Hand Degrees: {degrees_mins}")
print(f"Second Hand Degrees: {degrees_secs}")
calcstakes three parameters (def calcs(hrs, mins, secs):), but you didn't pass any (degrees = calcs()). What are you wanting thehrs,secsandminsvalues to be?hrs,mins, andsecsto be what the user inputs. They are to be used to calculate thereturn [degrees_hrs, degrees_mins, degrees_secs]calcs(hrs, mins, secs).def calcs(hrs, mins, secs):does?