KnowledgeBoat Logo
|

Informatics Practices

Find errors in the following code fragment.

Name = "Prateek"
Age = 26
print("your name & age are", Name + Age)

Python Funda

1 Like

Answer

The error in the above code is in the print statement. We cannot concatenate a string (Name) and an integer (Age) directly using the '+' operator. The corrected code is:

Name = "Prateek"
Age = 26
print("Your name & age are", Name + str(Age))

Answered By

1 Like


Related Questions