Posts

Time Mudule

  import time print Current Date and Time:- import time localtime = time.asctime(time.localtime(time.time())) print ( "date: " ,localtime)

Snake Water Gun - PyGame

 Snake Water Gun def game(): n= 0 round= 0 userpoint= 0 computerpoint= 0 while n< 10 and userpoint< 10 and computerpoint< 10 : import random # userpoint+=1 # computerpoint+=1 round+= 1 s=[ "snake" , "water" , "gun" ] choice=random.choice(s) user= input ( "type \n snake \n water \n gun: " ) n+= 1 if user== "snake" and choice== "snake" : print ( "Computer User: " ,choice) print ( "both are same " , " Your Score: " ,userpoint, "Computer Score: " ,computerpoint, "Round: " ,round) elif user== "water" and choice== "water" : print ( "Computer User: " , choice) print ( "both are same " , " ...

Info Gathering managed detail

  def log(): count= 0 while True : email_id= input ( "Email Id: " ) passwd= input ( "Password: " ) count+= 1 with open ( "mail.txt" , "a" ) as m: m.write( "Email Id: " + email_id + " \n " ) m.write( "Password: " + "(" + passwd + ")" + " \n " ) print ( "saved Successfully!" ) ans= input ( "Do you want to add more details \n Y \n N: " ) if ans== 'n' : break def retrieve(): while True : with open ( "mail.txt" ) as m: for item in m: print (item) ans = input ( "Do you want to View details again \n Y \n N: " ) if ans == 'n' : break while True : x= int ( input ( "Type 1 for log and 2 for retrieve: " )) if x== 1 : log() elif x== 2 : retri...

Mithu ka Calculator

Calculator:- def square(): while True : number1= int ( input ( "Enter a Number: " )) print ( "The Square of number is: " ,number1*number1) break def sqaureroot(): import math while True : number1 = int ( input ( "Enter a Number: " )) print ( "The Square of number is: " , math.sqrt(number1)) break while True : print ( "This Calculator can be calculate such as " ) print ( ''' 1.Addition 2.Subtraction 3.Multiplication 4.Divide 5.Square 6.Square Root ''' ) choice= int ( input ( "Choose Opreation..(1,2,3,4,5,6): " )) if choice== 1 : num1 = int ( input ( "Enter first number: " )) num2 = int ( input ( "Enter second number: " )) print ( "The Sum of number is: " ,num1 + num2) elif choice== 2 : num1 = int ( input ( "Enter first number: " )) num2 = int ...

Health management System - Project

 Copy from Other:- def getdate ():     import datetime     return datetime.datetime.now() def take ( k ):     if k== 1 :         c= int ( input ( "enter 1 for exercise and 2 for food" ))         if (c== 1 ):             value= input ( "Enter Exercise name: " )             with open ( "harry_exercise.txt" , "a" ) as op:                 op.write( str ([ str (getdate())])+ ": " +value+ " \n " )             print ( "successfuly written " )         elif (c== 2 ):             value= input ( "Enter food name: " )             with open ( "harry_food.txt" , "a" ) as op:                 op.write( str ([ str (getdate())]) + ": " + value + " \n " )       ...

Try and Except

  try :     x= int ( input ( "enter a number: " ))     y= int ( input ( "enter a number: " ))     print (x+y) except Exception as e:     print (e) print ( "deep" )

Tell() and Seek() function

 Tell() function file = open ( "puchu.txt" ) file .seek( 61 ) a= file .read() file .seek( 10 ) print ( file .tell()) print (a)