+ 2
Why isn't x getting assigned?
I did this code: https://code.sololearn.com/cDt908Hq0iXt/?ref=app it's giving me some error. I don't get it. any idea how to get it running?
4 Réponses
+ 4
On line 3, the print statement outputs string data. the value you are giving it is an integer value trying to add into a string. You either need to convert it to a string str(x) or use a comma in the print statement.
The print function can auto convert data types if they're not in the same argument (comma separation) as a different data type. For example:
print(str(x) + " is the value")
or
print(x, "is the value")
+ 3
you are trying to add a string and an int
0
Well my answer was the same as theirs so:
what they said.