I already asked this within another question but have the feeling it might need a new post as it is a different topic. I have tried the following code but it is not working. Can anyone tell me where my mistake is?
v = float(input("Choose a travelling speed: ")
if v == 17:
f = [16560, 24840, 41400, 57960, 82800],
c = [1,2,3,4,5]
elif v == 19:
f = [27600, 33120, 57960, 82800, 110400],
c = [1, 2, 3, 4, 5]
elif v == 24:
f = [60720, 77280, 124200, 182160, 242880],
c = [1, 2, 3, 4, 5]
else:
print("Undefined travelling speed!")
exit()
print(sum([i*j for i, j in zip(f[1:5], c[1:5])]))
I want the program to print the sum of the values for f and c depending on the speed that was initially put in for v (only the three available options for now). Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire