Posts

Showing posts from June, 2022

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" )