BASICS OF IF ELSE IN PYTHON AND FIBONACCI SERIES
#if elsevar=5
if var==5:
print("correct")
##############################################
if var==6:
print("correct")
else: print("incorrect")
##############################################
username="rohan"
password=1234
if username=="rohan" and password==1234:
print("user name and password matched.")
else:
print("enter correct info")
##############################################
if username=="roan" and password==1234:
print("user name and password matched.")
else:
print("enter correct info")
##############################################
'''''''''output of above code
correct
incorrect
user name and password matched.
enter correct info
####################################################################
FIBONACCI SERIES
num1=0
num2=1
r=int(input("Enter Upto Number::"))
print("0")
print("1")
for i in range(2,r):
c=num1+num2
print(c)
num1=num2
num2=c
####################################################################
Enter Upto Number::15
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
Comments
Post a Comment