New course! Every coder should learn Generative AI!
Try a free lesson0
what can i do to make this program better
mileage calculator in python https://code.sololearn.com/cf058ugHJWQ2/?ref=app
4 Answers
+ 3
First of all, convert the print statements to methods by enveloping their arguments in parentheses - Sololearn uses Python 3.x. Other than that, the code looks like it should work alright :)
+ 2
as @Isaiah said you will need that. its all good in the beginner level and learning level. afterwards in the professional field you have to sanitize the inputs.
+ 2
Try double quotes... print ("like this").
0
I wrote this in python 2.6 ide but ive been learning on sololearn python 3. it works fine in 2.6 but when i post it here it seems its never happy, ive tried encapsulating my print arguments in () and it gives me eof error. i tried input.isdigit() to sanitize my input and it errors saying .isdigit method has no attribute. also on my ide it gives an input prompt and accepts a value, on here it gives one blank input and errors before the next input. i can read python fairly well but writing it is a different story. should i stop learning py3 and learn py2 before i confuse myself? or is it bc this is a web app that im not coding it sufficiently.