मराठी

Observe the following program carefully, and identify the error: def create (text, freq): for i in range (1, freq): print text create(5) #function call - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Observe the following program carefully, and identify the error:

def create (text, freq):
            for i in range (1, freq):
              print text
create(5)           #function call
टीपा लिहा
Advertisements

उत्तर

There are two errors in the given program.

  1. The function “create” is defined using two arguments, 'text' and 'freq', but when the function is called in line number 4, only one argument is passed as a parameter. It should be written ‘create(5, 4)’ i.e with two parameters.
  2. The syntax of the ‘print’ function is incorrect. The correct syntax will be ‘print(text)’.
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 7: Functions - Exercise [पृष्ठ १७०]

APPEARS IN

एनसीईआरटी Computer Science [English] Class 11
पाठ 7 Functions
Exercise | Q 1. a) | पृष्ठ १७०
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×