rewrite the program after correcting the errors in the box
a. n=6
If N%2 = 0
Print "n, is divisible by 2"
b. a=10, b= 20
Sum = a + b
Print(Sum of numbers is +sum))
Answers
Answered by
6
Answer:
a. n=6
if n%2==0:
print(n, "is divisible by 2")
b. a=10
bp
Answered by
5
Concept:
Errors are faults or flaws in a program that causes the program's behavior to be abnormal.
Given:
a) n=6
If N%2 = 0
Print "n, is divisible by 2"
b) a=10, b= 20
Sum = a + b
Print(Sum of numbers is +sum))
Find:
Rewrite the programs after removing the errors.
Solution:
In Python, there are three types of errors that can be distinguished: syntax errors, exceptions, and logical errors.
a) Program after removing errors:
n=6
if n%2 == 0:
print(n,"is divisible by 2")
Output: 6 is divisible by 2
b) Program after removing errors:
a=10
b= 20
Sum = a + b
print("Sum of numbers is",Sum)
Output: Sum of numbers is 30
Similar questions
Math,
1 month ago
English,
1 month ago
Social Sciences,
2 months ago
English,
2 months ago
Math,
9 months ago