1.

Find the error(s) in the following code and correct them:1.  def describe intelligent life form ():2.  height = raw_input (“Enter the height”)3.  raw_input (“Is it correct ?”)4.  weight = raw_input (“Enter the weight”)5.  favorite-game = raw_input (“Enter favorite game”)6.  print “your height”, height, ‘and weight’, weight7.  print “and your favorite game is”, favorite- game, ‘.’

Answer»

Here, function name contains spaces. But function name should be a valid Python identifier with no spaces in between. And here, no variable is defined to obtain value being input. Lines 4 and 6 are badly indented; being part of same function, those should be at the same indentation level as that of lines 2, 3, 5 and 7. And also, variable favourite-game is an invalid identifier as it contains a hyphen, but it should have been an underscore.



Discussion

No Comment Found