12. Identify the error in the following python statement:
print("My Name is”, first_name)
write the correct statement also.
Answers
Answered by
1
Answer:
Print "My name is", name
There are 3 errors in the statement.
The use of uppercase 'p' instead of lowercase. [Syntax error]
The omission of brackets. [Syntax error]
The assignment of the variable 'name'. [Name error]
Solution:
>>> name = xyz
>>> print("My name is", name)
Output:
\tt My\ n ame\ is\ xyzMy name is xyz
Syntax errors occur due to the violation of rules of the program whilst Name errors occur if no value has been assigned to 'name'.
Answered by
0
Explanation:
U r supposed to do like this... See the program and its output.... First _name is user defined... U have to use input function with it...
Thank u...
(u can use pydroid app frm playstore to work out the pgms if dont have laptop)
Attachments:
Similar questions