Find errors in the following code(if any) and correct the code by rewriting it and underlining
corrections.
x=int(“Enter value for x))
for in range[0,11]:
if x=y
print x+y
else:
print x-y
waiting for early replies guys....
Answers
Answered by
76
Answer:
x=int(input("Enter value for x"))
for i in range(0,11):
if x=y:
print(x+y)
else:
print(x-y)
Answered by
7
Answer:
x=int(input("Enter value for x"))
for i in range(0,11):
if x==y:
print(x+y)
else:
print(x-y)
Explanation:
as we know python is case sensitive the errors are as follow:
1. we have to write input in another bracket
2. for range we use parenthesis instead of square brackets
3. we put colon in the end of x=y
4.we put x+y in parenthesis ,similarly in print x-y
NOTE: we should always take care of indentation level
Similar questions
Environmental Sciences,
5 months ago
Math,
5 months ago
Math,
5 months ago
Social Sciences,
11 months ago
Social Sciences,
11 months ago
Chemistry,
1 year ago
Math,
1 year ago