Python 1 if we declare a varibale as apple banana which err

[Python]

1. if we declare a varibale as

apple = banana

which error will it cause?

1. name error

2. syntax error

-----------------------------

2. Consider this code:

def multiple(number1, number2):
print(number1 * number2)

result = multiple(2, 3)
new_result = result + 1
What is the outcome of executing the code above?

1.TypeError
2.new_result is 4
3.new_result is 7

---------------------------

3. Which of the following is an appropriate definition for the function triple that returns three times the number it is passed?
  
1.triple(x) = 3 * x
   
2.def triple(x):
return 3 * x

3.def triple(x)
return 3 * x


4.def triple(x):
3 * x

-----------------------------

4. Select the legal Python name(s) below.
1.newyear_2015
2.123Value
3.NewYEAR_2015
4._newyear2015

-------------------------------

5. In the following code:

def result(a, b, c):

return a*b/c

How many parameter does function result have?

  

Solution

1. Name Error

Reason = \'banana\' is not defined.

2. Type Error

Reason =  unsupported operand type(s) for +: \'NoneType\' and \'int\'

3. 2nd option

def triple(x):

return 3*x

4. Options 1,2 and 4

1.newyear_2015

2.123Value

4._newyear2015

5. No. of parameters = 3 (In this case, they are a,b and c).

[Python] 1. if we declare a varibale as apple = banana which error will it cause? 1. name error 2. syntax error ----------------------------- 2. Consider this c
[Python] 1. if we declare a varibale as apple = banana which error will it cause? 1. name error 2. syntax error ----------------------------- 2. Consider this c

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site