Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Fix Error: Cannot Concatenate Int and Str in Python



This error is coming because the interpreter is replacing the %d with i and then trying to add 1 to a str, ie, adding a str and an int. In order to correct this, just surround the i+1 in parentheses. 

example

print("\

Num %d" % (i+1))
Updated on: 2020-03-12T12:31:58+05:30

98 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements