You are on page 1of 8

#TO PRINT THE FIBONACCI SERIES

n=10
a=0
b=1
print(a)
print(b)
i=0
while True:
i=i+1
if(i<=10):
c=a+b
print(c)
a=b
b=c
else:
break
****************************************OR************************
*******************
n=int(input('enter the value of n'))
a=0
b=1
print(a)
print(b)
while True:
if(n!=0):
c=a+b
print(c)
a,b=b,c
n=n-1
#TO PRINT THE FIBONACCI SERIES based on User input

n=int(input('enter the value of n '))

a=0

b=1

print(a)

print(b)

i=0

while True:

i=i+1
if(i<=n):

c=a+b

print(c)

a=b

b=c

else:

print('out of loop')
break
#Sample program to check if the given input is mobile number

mno=int(input('enter the value of mno '))

count=0

k=mno

while True:

if(type(mno%10)==int):

count=count+1

mno=mno//10

if(mno//10==0):

break

if(count==9):

print(k,"is mobile number")

else:

print(k,"is not mobile number")

QUIZ
1) x = 12

y = 18

x=y

y=x

print(x,y)

Ans:
2) what is an exponent operator?

Ans:

3) What is a operator(quotient)?

Ans:

4) math=3**3? result?

Ans:

5) 26%7 result?

Ans:

6) what is the result of 13?2--->

Ans:

7) which of the following gives me integer o/p?

a) x = 13 // 2

b) x = int(13 / 2)

c) x = 13 / 2

d) x = 13 % 2

Ans:
8) What is the average value of the code that is executed below ?

>>>x = 80

>>>y = 90

>>>average =float( (x +y) / 2)

a) 85

b) 85.0

c) 95

d) 95.0

ANS:

9) If i would like to print the following result hello-how-are-you what should be


the print statement?

a) print('hello','how', 'are', 'you')

b) print('hello', 'how', 'are', 'you' + '-' * 4)

c) print('hello-' + 'how-are-you')

d) print('hello' + '-' + 'how' + '-' + 'are' + '-' + 'you')

Ans:
10) What is the result of following code?

a=8

if (a=='8'):

print(' good morning')

else:

print('good bye')

Ans:

You might also like