diff --git a/Programs/worddetector.py b/Programs/worddetector.py new file mode 100644 index 0000000..5daae55 --- /dev/null +++ b/Programs/worddetector.py @@ -0,0 +1,27 @@ +#this can be used to find files which have a word hidden in them +import os +fileformat=input("fileformat you want to find the word in")#file format to find the word in +wordtobefound=input("what word do you want to find in this folder's files")#word which you want to find +def wordfinder(filename): + with open(filename, "r") as f: + filecontent = f.read() + #.lower written below because the word may be like this heLlO + if wordtobefound in filecontent.lower(): + return True + else: + return False +dir_contents= os.listdir() +print(dir_contents) +nwordtobefound=0 +for item in dir_contents: + if item.endswith(fileformat): + print(f"detecting {wordtobefound} in {item}") + flag = wordfinder(item) + if(flag): + nwordtobefound=nwordtobefound+1 + print(f"{wordtobefound} found in {item}") + else: + print(f"{wordtobefound} not found in {item}") +print("wordfinder summary") +print(f"{nwordtobefound} files found with {wordtobefound} hidden into them") +input() diff --git a/automatic file arranger.py b/automatic file arranger.py new file mode 100644 index 0000000..cc3c792 --- /dev/null +++ b/automatic file arranger.py @@ -0,0 +1,29 @@ +import os +def createifdosentexist(folder): + if not os.path.exists(folder): + os.makedirs(folder) +def move(foldername,files): + for file in files: + os.replace(file, f'{foldername}/{file}') +files=os.listdir() +createifdosentexist('images') +createifdosentexist('docs') +createifdosentexist('media') +createifdosentexist('programs') +createifdosentexist('others') +imgExts=['.png','.jpg','.jpeg'] +docexts=['.docx','.txt','.doc','pdf'] +programexts=['.py','.java','.html','.css','.js'] +images=[file for file in files if os.path.splitext(file)[1].lower() in imgExts] +docs=[file for file in files if os.path.splitext(file)[1].lower() in docexts] +programs=[file for file in files if os.path.splitext(file)[1].lower() in programexts] +mediaexts=['.3g2','.flv','.mov','.mp3','.mp3'] +medias=[file for file in files if os.path.splitext(file)[1].lower() in mediaexts] +for file in files: + ext=os.path.splitext(file)[1].lower() +others=[] +move("images", images) +move("media", medias) +move("docs", docs) +move('programs', programs) +move("others", others) diff --git a/healthmanagementsoftware.py b/healthmanagementsoftware.py new file mode 100644 index 0000000..ef1f4d9 --- /dev/null +++ b/healthmanagementsoftware.py @@ -0,0 +1,108 @@ +""" +health management software +this program is a sample project for healthmangement system. +you can edit the filenames and people names here. +this helps you to monitor your diet and exercises you do. +log means to enter diet or exercise. +retrive means to see what you have written. +""" +print("dont get worried when you see the below warnings") +print("there just coming because the file already exists") +print("but if you see this all warnings coming for the first time then put a issue on it") +try: + firstfile=open("person1diet.txt","x") +except Exception as e: + print(e) +try: + secondfile=open("person2diet.txt","x") +except Exception as f: + print(f) +try: + thirdfile=open("person3diet.txt","x") +except Exception as j: + print(j) +try: + fourthfile=open("person1execise.txt","x") +except Exception as g: + print(g) +try: + fifthfile=open("person2exercise.txt","x") +except Exception as k: + print(k) +try: + sixthfile=open("person3exrciser.txt","x") +except Exception as m: + print(m) +logorretrieve=int(input("press 0 for logging and press 1 for retrieveing\n")) +dietorexercise=int(input("press 0 for diet and press 1 for exercise\n")) +whomm=int(input('press 0 for person1,press 1 for person2 and press 2 for person3\n')) +def gettime(): + import datetime + return datetime.datetime.now() +if logorretrieve == 0 and dietorexercise == 0 and whomm == 0: + Food=input("what food you want to store\n") + a=open("person1diet.txt","a+") + time=str(gettime()) + a.write(time) + a.write(Food) + a.write("\n") +elif logorretrieve==0 and dietorexercise==0 and whomm==1: + Foodr=input("what food you want to store\n") + a=open("person2diet.txt","a+") + time=str(gettime()) + a.write(time) + a.write(Foodr) + a.write("\n") +elif logorretrieve==0 and dietorexercise==0 and whomm==2: + Foodh=input("what food you want to store\n") + a=open("person3diet.txt","a+") + time=str(gettime()) + a.write(time) + a.write(Foodh) + a.write("\n") +elif logorretrieve==0 and dietorexercise==1 and whomm==0: + exercise=str(input("what exercise you want to store\n")) + a=open("person1execise.txt","a+") + time=str(gettime()) + a.write(time) + a.write(exercise) + a.write("\n") +elif logorretrieve==0 and dietorexercise==1 and whomm==1: + exerciser=input("what exercise you want to store\n") + a=open("person2exercise.txt","a+") + time=str(gettime()) + a.write(time) + a.write(exerciser) + a.write("\n") +elif logorretrieve==0 and dietorexercise==1 and whomm==2: + exerciseh=input("what exercise you want to store\n") + a=open("person3exrciser.txt","a+") + time=str(gettime()) + a.write(time) + a.write(exerciseh) + a.write("\n") +elif logorretrieve == 1 and dietorexercise == 0 and whomm == 0: + a=open("person1diet.txt","r") + print(a.read()) + input() +elif logorretrieve==1 and dietorexercise==0 and whomm==1: + a=open("person2diet.txt","r") + print(a.read()) + input() +elif logorretrieve==1 and dietorexercise==0 and whomm==2: + a=open("person3diet.txt","r") + print(a.read()) + input() +elif logorretrieve==1 and dietorexercise==1 and whomm==0: + a=open("person1execise.txt","r") + print(a.read()) + input() +elif logorretrieve==1 and dietorexercise==1 and whomm==1: + a=open("person2exercise.txt","r") + print(a.read()) + input() +elif logorretrieve==1 and dietorexercise==1 and whomm==2: + a=open("person3exrciser.txt","r") + print(a.read()) + input() +a.close() diff --git a/nathansproblem.py b/nathansproblem.py new file mode 100644 index 0000000..bcc68e1 --- /dev/null +++ b/nathansproblem.py @@ -0,0 +1,19 @@ +card=list(input("enter 0 for up and 1 for down")) +''' +Twenty random cards are placed in a row all face down. A turn consists of taking two adjacent cards where the left one is face up and the right one can be face up or face down and flipping them both. Show that this process must terminate. (with all the cards facing up). +''' +def transform(b): + for i in range(len(b)-1): + if b[i] == 1: + b[1]=0 + if b[i+1]==0: + b[i+1]='1' + else: + b[i+1]='1' + return b +if __name__=='__main__': + a=list(card) + print(a) + while a != transform(a.copy()): + a=transform(a.copy()) + print(a) diff --git a/recieptmaker.py b/recieptmaker.py new file mode 100644 index 0000000..189e621 --- /dev/null +++ b/recieptmaker.py @@ -0,0 +1,23 @@ +sum = 0 +recieptname=input("name your recipt") +try: + f=open(f"{recieptname}.txt", "x") + f.close() +except Exception as e: + print(e) +reciept=[] +while(True): + userinput=input("enter price") + if userinput!="q": + sum = sum+int(userinput) + reciept.append(int(userinput)) + print(f"your total so far {sum}") + else: + print(f"thank for shooping with us") + print(f"your total is {sum}") + print(reciept) + break +a=open(f"{recieptname}.txt", "a") +a.write(str(reciept)) +a.close() + diff --git a/waternotification.py b/waternotification.py new file mode 100644 index 0000000..4cf254d --- /dev/null +++ b/waternotification.py @@ -0,0 +1,14 @@ +print("run using the command pythonw pythonnotification.py if you havent") +import time +from plyer import notification +if __name__=="__main__": + while(True): + notification.notify( + title = "please drink water", + message = "drink water to keep yourself hydrated", + app_icon="", #if you have a icon file for water glass image paste its path here + timeout=10 + ) + time.sleep(60*60) + +