Posts

Game rock, paper, scissor in python

 #Game rock, paper, scissor in python print( "Game By Toyajkumar \n" ) play_time = 1 Equal = 0 Lose = 0 Won = 0 while (play_time <= 5 ):     import random     list = [ "rock" , "paper" , "scissors" ]     choice = random.choice(list)     print( "Choice any one\n1 for rock\n2 for paper\n3 for scissors" )     you = int(input( ":- " ))     if you == 1 :         if choice == "rock" :             print( "Equal" )             Equal += 1         elif choice == "paper" :             print( "Lose" )             Lose += 1         elif choice == "scissors" :             print( "Won" )             Won += 1     if you == 2 :         if choice == "rock" :  ...

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== "...