I have no idea why this isn’t working. Can someone please help? It would be greatly appreciated!
10 Kracetime = input(‘Enter your race time for a 10K:’)
mins per k = 10 Kracetime / 10
secs_per_k = 10 Kracetime % 10
print('You ran at a pace of ’ + mins_per_k + ‘minutes’ + secs_per_k + ‘seconds per kilometer’)
assuming this is python (which we are kind of left to guess, you should really include this in the topic),
input() stores the result as string (assuming python3+, but again, not included in the topic), is this desired?
Also, in what way does your program not work? An interpreter error? Undesired behaviour of the program? Please put a bit more effort in, this which will result in a better reply, which profits you
Of course! I am new here, my apologies. This is python3+, and I was getting a syntax error. I believe i fixed the code, because the two example values that I plugged in
Enter your race time for a 10K: 44
You ran at a pace of 4 minutes 24 seconds per kilometer
Enter your race time for a 10K: 60
You ran at a pace of 6 minutes 0 seconds per kilometer
Kracetime = float(input('Enter your race time for a 10K:'))
mins_per_k = int(Kracetime // 10)
secs_per_k = (Kracetime % 10)*6
print('You ran at a pace of ', mins_per_k, 'minutes', secs_per_k, 'seconds per kilometer')
this code worked, but I did have to put *6 at the end of line three. Does that make the code prone to errors when the other values?
I think the code is correct.
Seems you solved it on your own