##### function help
 function help Nickd12 Wafer-Thin Wafer Posts: 83 Threads: 31 Joined: Aug 2020 Reputation: Nov-08-2020, 01:44 AM i do apologize i was messing around with finding different ways to do different things just exploring and learning. i was messing around having fun with time conversion. this is what i came up with im sure there is a better way but i was asking if its possible to avoid all the if statements ```def conversion(number, time, hms): if time == "minute": if hms == "second": minute_ = number * 60 elif hms == "minute": minute_ = number * 1 else: return return minute_ elif time == "hour": if hms == "second": hr = number * 3600 # 3600 seconds in an hour elif hms == "minute": hr = number * 60 elif hms == "hour": hr = number * 1 else: return return hr else: return # print(hour(1, h="second")) number = 1 # one hour time = "hour" # time in hms = "second" # seconds in a hour conver = conversion(number, time, hms) print(f"there are {conver} {hms}(s) in a {time}(s)")``` Reply

 Messages In This Thread function help - by Nickd12 - Nov-06-2020, 09:39 PM RE: function help - by Gribouillis - Nov-06-2020, 09:56 PM RE: function help - by jefsummers - Nov-07-2020, 07:35 PM RE: function help - by Nickd12 - Nov-08-2020, 01:44 AM RE: function help - by bowlofred - Nov-08-2020, 04:23 AM RE: function help - by Gribouillis - Nov-08-2020, 07:32 AM

Forum Jump:

### User Panel Messages

##### Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020