Posts

Showing posts from September, 2022

How to find odd and even number by using Python?

Image
  #How to find odd and even number by using Python? #Find Even and Odd number Between (1 to 10) #Find Even Number count= 0 print( "Even number" ) for number in range( 1 , 10 ):     if number % 2 == 1 :         count+= 1         print(number) print( f "total even number is {count} " ) #Find Odd Number count= 0 print( "Odd number" ) for number in range( 1 , 10 ):     if number % 2 == 0 :         count+= 1         print(number) print( f "total odd number is {count} " ) #After reading the code.

Basic calculator.

Image
Basic calculator . By Tryadav  def calculator(): print (("Calculator By Toyaj yadav\n")) print (("please choose one of the following options ( + , - , / , * )\n")) A = input ("Enter :- ") B = input ("number 1 :-  ") C = input ("number 2 :-  ") if A == "+": ans=(float(B)+float(C)) print((str(B)+(A)+(C)+(" = "))+(str(ans))) elif A == "-": ans=(float(B)-float(C)) print((str(B)+(A)+(C)+(" = "))+(str(ans))) elif A == "*": ans=(float(B)*float(C)) print((str(B)+(A)+(C)+(" = "))+(str(ans))) elif A == "/": ans=(float(B)//float(C)) print((str(B)+(A)+(C)+(" = "))+(str(ans)))  elif A: print(("SAMETHING IS WRONG !!!!!\n")) again() def again():     Z=input("Do you want to calculate again? Please type y for YES or x for No \n Enter :- ")     if Z== "y":         calculator()     elif Z== "...