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
"Comments are useful and an easy way to enhance readability and understandability of a program." Elaborate with examples.
Find errors in the following code fragment.
a = 3 print(a) b = 4 print(b) s = a + b print (s)Find errors in the following code fragment.
A = 3 S = A + 10 A = "New" Q = A / 10Give the output.
x = 40 y = x + 1 x, y = 20, y + x print (x, y)