I need to add more functions, but that can wait, it's 1am.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | from math import * def velocity(): distance = int(input('Distance Travelled(m): ')) d = distance time = int(input('Time taken to travel from A to B(s): ')) t = time velocity = d / t v = velocity print('The Average speed is: ', v, 'm/s') def distance(): velocity = int(input('Enter average speed(m/s): ')) v = velocity time = int(input('Enter time taken to travel from A to B(s): ')) t = time distance = v * t d = distance print('The distance travelled is: ', d, 'm') def time(): distance = int(input('Distance Travelled(m): ')) d = distance velocity = int(input('Enter the average speed(m/s): ')) v = velocity time = d / v t = time print('The time taken to travel from A to B is: ', t, 's') def acceleration(): change_in_speed = int(input('Enter change in speed: ')) time_taken = int(input('Enter time taken for change: ')) c = change_in_speed t = time_taken a = c / t print('The acceleration is: ', a, 'm/s(sqrt)') print('''1) Calculate Velocity 2) Calculate Distance 3) Calculate Time 4) Calculate Acceleration ''') def choose(): print() choice = int(input('Choose the one of the options above (e.g. 1,2,3 etc.) ')) if choice == 1: velocity() elif choice == 2: distance() elif choice == 3: time() elif choice == 4: acceleration() else: print('Please choose 1, 2 or 3!') while 1: choose() |