I want you to pick my code apart and give me some feedback on how I could make it better or more simple. In my opinion this is the best code I have written, being that I'm new to programming. The program is a basic "converter" that has the user input his/her age and it tells how many days, hours, and minutes the user has been alive. Let me know what you think!
import time
import sys
def name():
name = input("What is your name? ")
while name.isdigit():
print("Make sure to enter an actual name.")
name = input("What is your name? ")
return name
def user_input():
while True:
age = input("What is your age? ")
try:
return int(age)
break
except ValueError:
try:
return float(age)
break
except ValueError:
print("Make sure to enter a real age.")
def again():
while True:
again = input("Play again? Yes/No ").lower()
if again == "no":
sys.exit(0)
elif again == "yes":
break
else:
print("That was not an option.")
while True:
the_name = name()
age = user_input()
Days = age * 365
Hours = Days * 24
Minutes = Hours * 60
print("Ok {}, I have your results.".format(the_name))
time.sleep(2)
print("If you are {} years of age....".format(age))
time.sleep(2)
print("You are {} days old.".format(Days))
time.sleep(2)
print("You are {} hours old.".format(Hours))
time.sleep(2)
print("You are {} minutes old!".format(Minutes))
again()
NOTE: If you make a change, please explain to me why and how it works in the most simple way you can, so I understand it better.