I have started a tutorial on python, have no prior programming expirience. Currently, I am doing exercise 5, where i have to transform inches into centimeters or vice versa and a problem occurs. I am using a 2.12 python and am not planning to switch for the time being of this tutorial. I am very annoyed and frustrated why this simple problem occurs and that i can't figure out why. Here is the code:
centimeter = 1
inch = centimeter * 2,54
converted_value = 10 * inch
print "i decided to convert 10 inches to centimeters. Results are astonishing. %d " % converted_value
I ran the exercise in Windows powershell and it reported back to me this:
"Traceback (most recent call last):
File "vaja5.py", line 28, in <module>
print "i decided to convert 10 inches to centimeters. Results are astonishing. %d" % converted_value
TypeError: not all arguments converted during string formatting"
Thank you for all the help in advance. I really appreciate it
print fooinstead ofprint(foo)) shows that you are using Python2. Python2 is at its end of life. Please strongly consider to use Python3; if your tutorial is for Python2, strongly consider using a more up-to-date tutorial.