B01C – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12A-2018-B01C #PYTHON#6099    siteicon   siteicon  

Problem Statement - B01C

Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

Val = int(rawinput("Value:"))
Adder = 0

for C in range(1,Val,3)
    Adder+=C
    if C%2=0:
        Print C*10
    Else:
        print C*
print Adder

Solution

TC++ #6099

Val = int(raw_input("Value:"))  # Error 1
Adder = 0
for C in range(1,Val,3) :       # Error 2
    Adder+=C
    if C%2==0:                  # Error 3
        print C*10              # Error 4
    else:                       # Error 5
        print C                 # Error 6
print Adder

OR
Corrections mentioned as follows:

    raw_input in place of rawinput
    : to be placed in for
    == in place of =
    print in place of Print
    else in place of Else
    C* is invalid, replaced by a suitable integer or C


Share

CSKC| Created: 9-Jan-2019 | Updated: 9-Jan-2019|CBSE12A-2018









Back