Numbers Output#

Section Title: Numbers Output

  • Find the output of the following code.

  • Please don’t run the code before giving your answer.     

Question-1#

print(type(10/2))

Solution

<class ‘float’>

Question-2#

print(type(10//2))

Solution

<class ‘int’>

Question-3#

print(15%4)

Solution

3

Question-4#

print(5+12/3)

Solution

9.0

Question-5#

print(15//4)

Solution

3

Question-6#

print((23//3)%4)

Solution

3

Question-7#

print(3**4)

Solution

81

Question-8#

import statistics
average = statistics.mean([1,5,12])
print(average)

Solution

6

Question-9#

import numpy
average = numpy.mean([5,10,9])
print(average)

Solution

8.0

Question-10#

rd = round(12.345,2)
print(rd)

Solution

12.35

Question-11#

rd = round(12.367,1)
print(rd)

Solution

12.4

Question-12#

x = 10
x = x+1
print(x)

Solution

11

Question-13#

x = 20
x += 1
print(x)

Solution

21

Question-14#

x = 10
x = x+1
x += 1
print(x)

Solution

12

Question-15#

x = 10
x -= 2
x *= 5
x = x+1
print(x)

Solution

41

Question-16#

x = 10
x -= 7
print(x)
x *= 2
print(x)

Solution

3
6

Question-17#

x = 0
print(x*'a'+'?'+x*'a')
x += 1
print(x*'a'+'?'+x*'a')
x += 1
print(x*'a'+'?'+x*'a')
x -= 1
print(x*'a'+'?'+x*'a')
x -= 1
print(x*'a'+'?'+x*'a')

Solution

?
a?a
aa?aa
a?a
?

Question-18#

x = '5.07'
y = float(int(float(x)))
print(y)

Solution

5.0

Question-19#

x = 2
y = 5
print(str(x)+' * '+str(y)+' = '+str(x*y))

Solution

2 * 5 = 10