

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python: Cannot understand why the error - cannot concatenate 'str' and 'int' object ?
This can be corrected by putting n+1 in brackets i.e. (n+1)
for num in range(5): print ("%d" % (num+1))
Using %d casts the object following % to string. Since a string object can't be concatnated with a number (1 in this case) interpreter displays typeerror.
- Related Questions & Answers
- Python: Can not understand why I am getting the error: Can not concatenate 'int' and 'str' object
- How can I concatenate str and int objects in Python?
- Why constructor cannot be final in Java
- TestNG error:- Cannot find class in classpath using Selenium
- Why a constructor cannot be final in Java?
- What can cause a Cannot find symbol error in java?
- Why an interface cannot implement another interface in Java?
- What can cause the "cannot find symbol" error in Java?
- What are the things money cannot buy?
- Why cannot I use iframe absolute positioning to set height/width
- Why cannot we specify access modifiers inside an interface in C#?
- Why we cannot use MySQL DATE data type along with time value?
- MySQL error 1452 - Cannot add or a child row: a foreign key constraint fails
- Why we cannot use comparison operator(=) for getting the rows with NULL from a table?
- Why "this" keyword cannot be used in the main method of java class?
Advertisements