Predict the output-
●y=x+5
print(x,y)
●print(x=y=5)
Answers
Answered by
1
Answer:
hi..
Explanation:
name error will occur in the above code as x is not defined..
hope it helps you..
Answered by
0
Answer:
y=x+5
print(x,y)
When you will execute these two lines, a name error will occur.
Because in the above code the name x is not defined so the interpreter could not find x. So printing its value is not possible.
print(x=y=5)
This line will throw a syntax error. Since you are writing the wrong syntax.
Explanation:
Errors are the kind of bugs in a program that terminates the execution abnormally.
There are two types of errors:
- Compile Time Errors
- Run-Time Errors.
- Compile Time Errors are those errors that are encountered at the time of compilation.
For example: in the above, name error and syntax error are compile-time errors.
- Run-Time Errors are those errors that are encountered when your program is running. The compiler or Interpreter could not detect run-time errors in advance.
For example, Wrong logic, infinite loop, etc are run-time errors.
#SPJ3
Similar questions