raining = True statement2="no pandemic" if statement2 and not raining: print("we go to beach") elif statement2 and raining: print("we go to library") else: print("we go home")
raining=True norain=False statement="no pandemic" print("we go to beach") if statement and not norain else "we go home" print("we go to library") if statement and raining else "we go home" ~
pendemic=False rain=True if not pendemic and not rain: print("go to the beach") elif not pendemic and rain: print("go to the library") else: print("go to the home") ~
# uses of ternary operator ,and/or operator pendemic=False rain=False print('we go to the beach' if not pendemic and not rain else 'library') print('we go to the library' if not pendemic or rain else 'beach') print('beach' if pendemic else 'we go to home')
terms=int(input("Enter the number of terms:"))#taking number of terms input from user
sum=0 sec=1 print(sum)#printing first term print(sec)#printing second term for i in range(1,terms+1):#iterating up to number of terms
a=sum+sec#a is sum of first term and second term sum=sec#second term is assigned to first so as to update first term sec=a#and sum of both term is assigned to second term print(a)