मराठी

The code given below accepts a number as an argument and returns the reverse number. Observe the following code carefully and rewrite it after removing all syntax and logical errors. - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

The code given below accepts a number as an argument and returns the reverse number. Observe the following code carefully and rewrite it after removing all syntax and logical errors. Underline all the corrections made.

define revNumber (num) :
      rev = 0
      rem = 0
      While num > 0:
            rem ==num %10
            rev = rev*10 + rem
            num = num//10
            return rev
print (revNumber (1234))
टीपा लिहा

उत्तर

def revNumber (num) :
          rev = 0
          rem = 0
          while num > 0:
               rem =num %10
               rev = rev*10 + rem
               num = num//10
       return rev
print (revNumber (1234))
shaalaa.com
Syntax Errors
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2023-2024 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×