Reputation: 17
print("How many kms do you want to convert?");
kms = input();
miles = float(kms) / 1.60934;
print("OK converted data is :" + round(miles, 2));
I want to execute this python program in visual studio 2015 but when I enter a integer it returns nothing and when I enter a float number it returns this error: This is the output
Can you please correct my code?
Upvotes: 0
Views: 53
Reputation: 26
I think the problem was the type of the round(miles, 2)
print("How many kms do you want to convert?")
kms = input()
miles = float(kms) / 1.60934
print("OK converted data is :" + str(round(miles, 2)))
this works for me, and about the semicolons, I don't know well about it(So do whatever you want)
And the problem was, that integer types and string types couldn't join via "+", so I added str() to convert it to string!
Upvotes: 1