I'm a novice programmer. I started with Java years back and now mostly use VBA to automate tasks for my internships. I want to graduate from VBA and get into Python/R to properly automate tasks. The below code is my first Python project. I would like any of you to point out how it can be improved.
The program is meant to take in a time in HH:MM format and print out at what degrees (from 12:00) each of the hands will be at. This was adapted from a common finance interview brainteaser guide.
I'm thinking that if I get some good suggestions for this code I'll go ahead and make one that includes a second hand.
input_time = input("Please input a time (HH:MM)") time = input_time.split(":") clock_degrees = 360 clock_hours = 12 clock_minutes = 60 clock_degreesperhour = clock_degrees/clock_hours clock_degreesperminute = clock_degrees/clock_minutes miunte_hand_degrees = int(time)*clock_degreesperminute if (time == "12"): time = "0" hour_hand_degrees = (int(time)*clock_degreesperhour)+((int(time)/clock_minutes)*clock_degreesperhour) print("When the time is", input_time, 'the hour hand is at', hour_hand_degrees, "° and the minute hand is at", miunte_hand_degrees, "°")