I am solving an average speed formula and the inputs depends on how many elements the user want to input for the distance. After inputting the distance, time will also be included. The distance should be multiply with the time sequentially. For example, I inputted 2 in elements for the distance
2 inputs (distance):
10
20
2 inputs (time):
2
3
I want it be like 10 * 2, 20 * 3. Multiply it sequentially. And the final answer would be 80 by multiplying the distance to specific time. This is the code of mine.
print("================================")
print("Average Speed Formula")
print("================================")
tryingagain = True
while tryingagain:
print("DISTANCE")
num_array = list()
num = int(input("Enter how many elements of distance you want: "))
for i in range (0,num):
element = float(input(str(i + 1) + ". "))
num_array.append(element)
print ("TIME FOR DISTANCE (ENTER BASED ON DISTANCE INPUTTED (SEQUENTIALLY)")
num_array2 = list()
for i in range(0, num):
element1 = float(input(str(i + 1) + ". "))
num_array2.append(element1)
I did not include the computation since mine is wrong. This is the code that only working