Posts

python-HEALTH MANAGER

import datetime def getdate (): return datetime.datetime.now() def add_exer_food (client): if client == "1" : add_exer_diet = input ( " \n -->Enter number 1 for exercise \n and \n -->2 for food" ) add_item = input ( " \n -->what do you want to add in the list" ) if add_exer_diet== "1" : with open ( "chetan_exercise.txt" , "a" ) as f: add = [ " [" ,getdate(), "] " ,add_item, " \n " ] for i in add: f.write( "%s" % i) print ( "item added succesfully" ) elif add_exer_diet== "2" : with open ( "chetan_food.txt" , "a" ) as f: add = [ " [" ,getdate(), "] " ,add_item, " \n " ] for j in add: f.write( "%s" % j) print ( ...

guessing a number code on python

num = 44 num_of_guesses = 1 print ( " \t\t <--*-->welcome to guessing of numbers<--*-->" ) print ( " \n Number of guesses are limited to only 9" ) while (num_of_guesses<= 9 ): user = int ( input ( " \n enter your guess: \n " )) if user< 44 : print ( "you enter less number please input greater number" ) elif user> 44 : print ( "you enter greater number please input smaller number. " ) else : print ( "you win \n " , end = "you guess the right one " ) print (num_of_guesses, "no of guesses you took to finish" ) break if num_of_guesses == 3 : print ( "[hint:'even number'] \n " ) elif num_of_guesses == 6 : print ( "[hint:'multiple of 11'] \n " ) print ( 9 -num_of_guesses, "no. of guesses left" ) num_of_guesses = num_of_guesses + 1 if (num_of_guesses > 9 ): ...

faulty calculator project

''' 45 * 3 = 555, 56+9 = 77, 56/6 = 4 ''' print ( " \n\t\t <-*->welcome to my faulty calculator<-*->" ) print ( " \n =>faulty for given below only: \n '45 * 3 = 555, 56+9 = 77, 56/6 = 4' " ) print ( "=>rest of all are correct operations" ) while True : print ( " \n\t choose from ('+','-','*','/')" ) o = input ( " \n please select a operator " ) if (o== "+" or o== "-" or o== "*" or o== "/" ): a1 = int ( input ( "enter first number: " )) a2 = int ( input ( "enter second number: " )) if o == "+" : if (a1== 56 and a2== 9 ): print ( 77 ) else : print (a1+a2) continue elif o== "-" : print (a1-a2) continue elif o== "*" : ...

quiz-1

''' while True: var1 = 6 var2 = 56 var3 = int(input()) if var3>var2: print("Greater") break elif var3==var2: print("equl") else: print("Lesser") continue list = [5,7,3] if 555 not in list: print("yes its in the list") ''' #quiz while True : input1 = int ( input ( "whats your age? \n " )) age = 18 if age > input1: print ( "you can't drive" ) elif age == input1: print ( "we can't decide, you have to come on office" ) else : print ( "you can drive it but safely" ) break

my first dictionary

def reply (): choice = input ( " \n type another word enter yes or no " ) return choice == "yes" print ( " \t Welcome to chetu's Dictionary \n " ) while True : print ( " \n choose from below letters please: " ) print ( "cat,dog,laptop,mobile" ) d1 = { "cat" : "a cute meme content" , "dog" : "honest" , "laptop" : "need of a coder" , "mobile" : "a touch screen machine" } user1 = input ( " \n enter your word: " ) print (d1.get(user1)) if not reply(): break

first python program

''' var1 = "hello world " var2 = 4 var3 = 36.7 print(var1 + str(var2) + str(var3)) print("enter your number") c = input() print("your number is ", int(c)) print("sum is ",int(c)+10) ''' print ( "enter first number " ) num1 = input () print ( "enter a second number " ) num2 = input () print ( "sum of two numbers is" , int (num1) + int (num2))