Posts

SNAKE,WATER AND GUN GAME WITH PYTHON

import random # Snake Water Gun or Rock Paper Scissors def gameWin ( comp , you ):     # If two values are equal, declare a tie!     if comp == you :         return None     # Check for all possibilities when computer chose s     elif comp == 's' :         if you == 'w' :             return False         elif you == 'g' :             return True         # Check for all possibilities when computer chose w     elif comp == 'w' :         if you == 'g' :             return False         elif you == 's' :             return True         # Check for all possibilities when computer chose g     elif comp == 'g' :         if you == 's' :             return False         elif you == 'w' :             return True print ( "Comp Turn: Snake(s) Water(w) or Gun(g)?" ) randNo = random . randint ( 1 , 3 ) if randNo == 1 :     comp = 's' elif randNo == 2 :     comp = 'w' elif

Making Spam message Detector using if else condition

Image
  # Program to detect spam msg text = input ( "Enter the message \n " ) if ( "make money online" in text ):   spam = True elif ( " subscribe this" in text ):   spam = True elif ( "click this" in text ):   spam = True elif ( "buy now" in text ):   spam = True elif ( "offer closes soon" in text ):   spam = True elif ( "be a crorepati" in text ):   spam = True else :     spam = False if ( spam ):     print ( "Be careful...! This is a spam message " ) else :     print ( "Don't worry...! This is not a spam " )        

PROGRAM TO FIND GREATEST NUMBERS OF FOUR

Image
  # program to find greatest numbers of four print ( "enter the first number" ) num1 = int ( input ()) print ( "enter the second number" ) num2 = int ( input ()) print ( "enter the third number" ) num3 = int ( input ()) print ( "enter the fourth number" ) num4 = int ( input ()) if ( num1 > num4 ):     f1 = num1 else :     f1 = num4 1 if ( num2 > num3 ) :     f2 = num2 else :     f2 = num3 if ( f1 > f2 ):     print ( str ( f1 )+ " is greatest number" ) else :     print ( str ( f2 )+ " is greatest number" )

Making a calculator through function in Python

Image
  So we are going to discuss function through the calculator example.  #Calculator in python using function def addition():   print("Enter the first number\n")   a=int(input())   print("Enter the second number\n")   b=int(input())   print("\nThe sum of two number:",a+b) def Substranction():   print("Enter the first number\n")   a=int(input())   print("Enter the second number\n")   b=int(input())   print("\n The Substranction of two numbers",a-b) def multiplication():   print("Enter the first number\n")   a=int(input())   print("Enter the second number\n")   b=int(input())   print("\n The multiplication of two numbers",a*b) def division():   print("Enter the first number\n")   a=int(input())   print("Enter the second number\n")   b=int(input())   print("\n The division is:",a/b) addition() Output:-    

Making a guess the number GAME (First game in python)

  HELLO EVERYONE ..! FINALLY I AM GOING TO MAKE MY FIRST GAME IN PYTHON THAT GAME NAME IS "GUESS THE NUMBER".  YOU CAN ALSO PLAY UISNG SOURCE CODE GIVEN BELOW: #GUESS THE NUMBER GAME IN PYTHON n = 18 number_of_guesses = 1 print ( "Number of guesses is limited to only 9 times: " ) while (number_of_guesses <= 9 ): guess_number = int ( input ( "Guess the number : \n " )) if guess_number < 18 : print ( "you enter less number please input greater number. \n " ) elif guess_number > 18 : print ( "you enter greater number please input smaller number. \n " ) else : print ( "you won \n " ) print (number_of_guesses, "no.of guesses he took to finish." ) break print ( 9 - number_of_guesses, "no. of guesses left" ) number_of_guesses = number_of_guesses + 1 if (number_of_guesses > 9 ): print ( "Game Over" )

Making a unique Faulty Calculator (Special program) in Python

Image
  SO I AM GOING TO MAKE A FAULTY CALCULATOR BY THE HELP OF IF-ELSE STATEMENTS. IT WILL CALCULATE ALL  THE THING CORRECTLY EXCEPT SOME OF THEM. """FAULTY CALCULATOR --: I am going to make a calculator which do all calculations correct except 45+3(it will return 555),56*9(it will return 77) and 56/6( it will return 4).""" print ( "Enter the first number \n " ) num1= int ( input ()) print ( "Enter an operator \n " ) op= input () print ( "Enter the second number \n " ) num2 = int ( input ()) if op== '+' : if num1== 45 and num2== 3 : print ( 555 ) else : print ( "The sum is:" ,num1+num2) elif op== '*' : if num1== 56 and num2== 9 : print ( 77 ) else : print ( "The product is:" ,num1*num2) elif op== '/' : if num1== 56 and num2== 6 : print ( 4 ) else : print ( "The division is :" ,num1/num2)

Making the voting eligibility checker

Image
SO IN THIS BLOG WE ARE GOING TO MAKE A PROGRAM OF VOTING ELIGIBILTY CHECKER  JUST  LIKE  OUR PREVIOUS DRIVING ELIGIBILITY CHECKER BY THE HELP OF IF-ELSE CONTROL STATEMENT. # Voting eligibility checker print ( "Enter your age" ) age = int ( input ()) if age>= 18 : print ( "You are eligible for voting" ) else : print ( "You are not eligible...!" )