Posts

STONE PAPER SCISSOR GAME WITH COMPUTER

  import random print ( " welcome to stone paper and scissors game " ) print ( " " ) num= 1 u= 0 c= 0 for i in range ( 0 , 10 ): left= 10 list = [ "s" , "p" , "c" ] choice = random.choice(list) print ( "Computer has guessed!! , Your turn." ) print ( "" ) print ( "Press (s) for Stone \n " "Press (p) for Paper \n " "Press (c) for Scissors \n " ) userc= str ( input ( "enter your choice -> " )) if userc==choice: print ( "You both have chossen same" ) if userc== "s" and choice== "c" : print ( "Yay!!, you have won" ) u=u+ 1 if userc== "s" and choice== "p" : print ( "Oh!! Computer has won" ) c=c+ 1 if userc== "p" and choice== "s" : print ( "Yay!!, You have won" )

HEALTH MANAGEMENT SYSTEM

  print ( " WELCOME TO HEALTH MANAGEMENT SYSTEM " ) print ( "Enter (1) for Naveen \n " , "Enter (2) for Rohan \n " , "Enter (3) for Jay \n " ) name= int ( input ( "Enter name" )) print ( "Enter (1) for Diet plan \n " , "Enter (2) for Excercise plan \n " ) plan= int ( input ( "Enter plan" )) def naveendiet (): f= open ( "naveen.txt" ) print (f.read()) f.close() def rohandiet (): f2= open ( "rohan.txt" ) print (f2.read()) f2.close() def jaydiet (): f3= open ( "jay.txt" ) print (f3.read()) f3.close() def naveenex (): f4= open ( "naveenex.txt" ) print (f4.read()) f4.close() def rohanex (): f5= open ( "rohanex.txt" ) print (f5.read()) f5.close() def jayex (): f6= open ( "jayex.txt" ) print (f6.read()) f6.close() if name== 1 : if plan== 1 :

Guess program in python

  g = 5 while (g< 6 ): print ( "Enter an Number to guess" ) num= int ( input ()) g=g- 1 if num> 18 : print ( "Please try smaller value" ) elif num< 18 : print ( "Please try larger value" ) elif num== 18 : print ( "Yes!! Right Guess" ) break print ( "You have " , g , "guesses left" ) if g== 0 : print ( "Game Over!!" ) break

Calculator

  print ( " MY CALCULATOR " ) print ( "enter 1st value" ) val1= int ( input ()) print ( "enter 2nd value" ) val2= int ( input ()) print ( "enter the operation to be performed 1->+ ,2->-, 3->/, 4->*" ) opp= int ( input ()) if val1== 56 and val2== 9 and opp== 1 : print ( "Answer is= 77" ) elif val1== 45 and val2== 2 and opp== 4 : print ( "Answer is= 555" ) elif val1== 56 and val2== 6 and opp== 3 : print ( "Answer is= 555" ) elif opp== 1 : ans= int (val1)+ int (val2) print (ans) elif opp== 2 : ans= int (val1)- int (val2) print (ans) elif opp== 3 : ans= int (val1)* int (val2) print (ans) elif opp== 4 : ans= int (val1)/ int (val2) print (ans)

Create A dictionary . Take input from the user and display its meaning.

Create A dictionary . Take input from the user and display its meaning. Source code for python print(" welcome to Dictionary ") dec={"set":"well define collection of uniform data. For more details refer www.dictionary.in " , "simple":"Easy to understand. For more details refer www.dictionary.in ", "bore":"Make a hole or diameter of piston. For more details refer www.dictionary.in ", "pedology":"Study os soil science. For more details refer www.dictionary.in ", "lust":"sexual desier. For more details refer www.dictionary.in "} print("Enter the word to be searched") Sword=input() print(dec.get(Sword)) print("Thanks for using it")

How to add elements to the list

 Source code for python  WAP a program to add elements to a list. print("Enter the nos. to be added into the list") num1=input() num2=input() num3=input() num4=input() print("The list is ")  numbers=[int(num1),int(num2),int(num3),int(num4)] print(numbers) --------------------------------------------------------------------------------------------------------------------------- Terms explanations num1,num2,num3,num4 ///// They are the variables name. numbers // IT is the list name.