Posts

Showing posts from August, 2024

Functions Module

 Functions Made By Me r """ Provides Some Daily Used Essential Functions. Made By |-|/\S|-||R """ from functools import reduce #                           FUNCTIONS def prct ():     """THIS PROGRAM PRINTS PERCENTAGE OF OBTAINED MARKS.     """     print ( prct . __doc__ )     n = input (         'Enter the obtained numbers within total numbers (eg: 77/100) or q to exit: ' . title ())     running = True     while running :         try :             if n == "q" :                 running = False             i = n . split ( '/' )             print ( f ' { (( float ( i [ 0 ])/ float ( i [ 1 ]))* 100 ) :.3f} %' )             n = input (       ...

My Projects

 9. Drink Water Reminder """ A Gentle drink water reminder... Made By Hashir Ahmad -------------------------------- """ import time from plyer import notification # Some Module Specific Variables time_step : int = 3600 N_title : str = "A Gentle Drink Water Reminder" N_message : str = "As it's important to stay hidrated,so you should also go and drink a glass of water.It will only take a couple of seconds..." N_timeout : int = 5 def runDrinWaterReminder ():     def compare () -> bool :         start_time = time . time ()         end_time = start_time + time_step   # One hour in seconds         while time . time () < end_time :             pass         return True     print ( __doc__ )     while True :         compare ()         # Notification         notific...

My Projects

 8. Today's News import requests from ShoutOut import speak def getNews () -> str :     queries = input ( "What type of news you are interested in? : " )     api_key = "b08c708b964844338697e322498f065b"     url = f "https://newsapi.org/v2/everything?q= { queries } &from=2024-07-18&sortBy=publishedAt&apiKey=" + api_key     news = requests . get ( url ). json ()     articles = news [ "articles" ]     # myarticle = []     mynews = ""     i = 0     for num , article in enumerate ( articles ):         # myarticle.append(article["title"])         print ( f " { i + 1 } : " + article [ "title" ])         speak( f " { i + 1 } : " + article [ "title" ])         print ( "Description: \n " + str ( article [ "description" ]))         speak( "Description: \n " + str ( article [ "d...

My Projects

 7.  A simple Talking Program def speak ( text : str or int )-> None :     """     |USE THIS If You want The COMPUTER TO TALK TO YOU.(0nly works on Windows)|     """     from win32com . client import Dispatch     speaker = Dispatch ( "SAPI.SpVoice" )     speaker .Speak( str ( text )) l = [ "Harry" , "Jerry" , "Noob" , "Hashim" ,] if __name__ == "__main__" :     for person in l :         speak ( f "Shout Out To { person } " )         print ( f "Shout Out To { person } " ) # help(Dispatch("SAPI.SpVoice").Speak(""))

My Projects

 6. A Simple Library Management System #  making a class class library :     memory = []     def __init__ ( self ,* books ):         self . shelf = []         self . no_of_books = 0         for index , i in enumerate ( books ):             self . shelf . append ( books [ index ])             self . no_of_books += 1     def showbooks ( self ):         print ( f 'books are { "," . join ( self . shelf ) } ' . title ())     def show_quantity_books ( self ):         print ( f 'no of books: { self . no_of_books } ' . title ())     @ classmethod     def showstoresinfo ( self ):         print ( library . memory ) class updated_library ( library ):     def add_books ( self ,* newbooks ):       for index , i in ...

My Projects

 5. File Renamer Program import os supported_file = ".png" def file_renamer ():     f_path = input ( 'enter path of file: ' . title ())     f_path = f_path . replace ( ' \\ ' , '/' )     f_path = f_path + '/'     i = 1     for file in os . listdir ( f_path ):         n_name = f_path + str ( i )+ supported_file         o_name = f_path + file         os . rename ( o_name , n_name )         i += 1 file_renamer ()

My Projects

 4. Seplin language SEPLIN IS A SECRET CODING LANGUAGE. AND THIS PROGRAM IS A SEPLIN CONVERTER. from random import choice see1 = ( 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' ,         'j' , 'o' , 'm' , 'x' , 'y' , 'z' , 'a' , 'b' , 'z' ) dee1 = ( 'k' , 'l' , 'm' , 'n' , 'o' , 'p' , 'q' , 'r' ,         's' , 't' , 'u' , 'a' , 'z' , 'w' , 'v' , 'x' , 'y' , 'z' , 'a' , 'b' , 'p' ) vee1 = ( 'w' , 'x' , 'y' , 'z' , 'a' , 'b' , 'c' , 'd' , 'e' ) see = choice ( list ( see1 )) dee = choice ( list ( dee1 )) vee = choice ( list ( vee1 )) def run ():     """     Seplin T0 English and En...

My Projects

 3. Snake Water Gun Game import random def run_game ():   print ( '--< welcome to snake water and gun game >--' . upper ())   print ( '''   s.snake   w.water   g.gun   ''' )   u_choice = input ( 'enter your choice: ' . capitalize ()). lower ()   c_choice = random . choice ([ 's' , 'w' , 'g' ])   print ( f 'computer choice is { c_choice } ' )   if c_choice == u_choice :     print ( 'Tie!!!' )   elif c_choice == 's' and u_choice == 'w' :     print ( 'you lose!!!' . title ())   elif c_choice == 's' and u_choice == 'g' :     print ( 'you win!!!' . title ())   elif c_choice == 'w' and u_choice == 's' :     print ( 'you win!!!' . title ())   elif c_choice == 'w' and u_choice == 'g' :     print ( 'you lose!!!' . title ())   elif c_choice == 'g' and u_choice == 's' :  ...

my projects

 2. KBC Program n = '''---    --  -------      ----        ---  --    ---    --   --  ---        -----      -------    --        ---  --    ---    --   --  ---        ---  ----  -------      ----      ''' print ( n , ' \n\n ' ) ques = [ 'Q1.WHAT IS THE CURRENCY OF ENGLAND a.dollar b.pound c.ruppee d.euro' , 'Q2.WHAT IS MEANING OF TAKING A NAP a.sleep b.bedtime c.short sleep d.homework' , 'Q3.WHICH COUNTRY IS BIGGER BY LAND AREA a.PAKISTAN b.kuwait c.vietnam d.papua new guinea' ,         'Q4.DIFFERENCE BETWEEN h2o and water a.same b.different c.almost same d.none' , 'Q5. WHICH COUNTRY IS RICHER BY FINANCIAL AND GDP STATUS? a.Usa b.SUDAN c.Egypt d.Norway' , 'Q6. WHICH IS BIGGER a.atlantic ocean b.Asia c.arctic ocean d.pac...

My projects

 1. my  first  ever code 🌙 # MY OLDEST CODE IN THIS PC>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ############################################################################################################################## # # # print(78**8975) ############################################################################################################################## # # # print("this is python terminal") ############################################################################################################################## # # # #print(6) ################################################################################################################################### # # # print("hekk nek bek\nho hgf") ############################################################################################################################## # # # print("hrer fd \'j\P\"") #####...

special python programs By Hashir Ahmad

 2.  Randint Finder Program NOTE : First create a file named "randint info.txt". from random import randint MyChoice = int ( input ( 'Enter desired number: ' )) times = 0 main = randint ( 1 , 10000 ) while True :     if main == MyChoice :         break     else :         main = randint ( 1 , 100000 )         print ( main )         times += 1         #with open('a.txt','a') as f:             #f.write(str(main)) print ( f 'It took { times } times to reach { main } ' ) with open ( 'randint info.txt' , 'a' ) as f :     f . write ( ' \n ' + str ( times )+ ' ' + str ( main ))     if times > 250000 :         f . write ( ' ThisTookMuchTime.' )     #with open('a.txt','a') as f:     #f.write(f'\nFOR {main}\n') a = input ( 'Wanna show doc? (enter or /): ' ) if a == ...

special python programs By Hashir Ahmad

 1. Guessing game program import random l = 0 h = 100 g = 0 num =( random . randint ( l , h )) bt = True try :     while (bt) :             inp =( input ( f 'enter guess between ( { 0 } - { h } ) or q to exit: ' . title ())). lower ()             if (inp) == 'q' :                 print ( 'Have a good time...' )                 bt = False             elif int ( inp )> num :                 print ( 'too high' . title ())                 g += 1                 continue             elif int ( inp ) < num :                 print ( 'tooo low number' . title ())               ...