diff --git a/Hand-Motion-Detection/requirements.txt b/Hand-Motion-Detection/requirements.txt index 2d618146455..c8e45b52a78 100644 --- a/Hand-Motion-Detection/requirements.txt +++ b/Hand-Motion-Detection/requirements.txt @@ -1,3 +1,3 @@ -numpy==1.26.1 +numpy==1.26.2 opencv_python==4.8.1.78 -mediapipe==0.10.7 +mediapipe==0.10.9 diff --git a/News_App/requirements.txt b/News_App/requirements.txt index fc3a139b2d4..044c00966ce 100644 --- a/News_App/requirements.txt +++ b/News_App/requirements.txt @@ -1,4 +1,4 @@ -solara == 1.22.0 +solara == 1.25.0 Flask gunicorn ==21.2.0 simple-websocket diff --git a/Python Program to Sort Words in Alphabetic Order.py b/Python Program to Sort Words in Alphabetic Order.py index f4ebe04a29c..3e4bd3564e5 100644 --- a/Python Program to Sort Words in Alphabetic Order.py +++ b/Python Program to Sort Words in Alphabetic Order.py @@ -1,18 +1,42 @@ -# Program to sort alphabetically the words form a string provided by the user +# Program to sort words alphabetically and put them in a dictionary with corresponding numbered keys +# We are also removing punctuation to ensure the desired output, without importing a library for assistance. -my_str = "Hello this Is an Example With cased letters" +# Declare base variables +word_Dict = {} +count = 0 +my_str = "Hello this Is an Example With cased letters. Hello, this is a good string" +#Initialize punctuation +punctuations = '''!()-[]{};:'",<>./?@#$%^&*_~''' # To take input from the user #my_str = input("Enter a string: ") +# remove punctuation from the string and use an empty variable to put the alphabetic characters into +no_punct = "" +for char in my_str: + if char not in punctuations: + no_punct = no_punct + char + +# Make all words in string lowercase. my_str now equals the original string without the punctuation +my_str = no_punct.lower() + # breakdown the string into a list of words words = my_str.split() -# sort the list +# sort the list and remove duplicate words words.sort() -# display the sorted words - -print("The sorted words are:") +new_Word_List = [] for word in words: - print(word) + if word not in new_Word_List: + new_Word_List.append(word) + else: + continue + +# insert sorted words into dictionary with key + +for word in new_Word_List: + count+=1 + word_Dict[count] = word + +print(word_Dict) diff --git a/async_downloader/requirements.txt b/async_downloader/requirements.txt index 45f1bccb697..7629a9fab81 100644 --- a/async_downloader/requirements.txt +++ b/async_downloader/requirements.txt @@ -1 +1 @@ -aiohttp==3.8.6 +aiohttp==3.9.0 diff --git a/file_ext_changer.py b/file_ext_changer.py new file mode 100644 index 00000000000..4d80261b052 --- /dev/null +++ b/file_ext_changer.py @@ -0,0 +1,129 @@ +'''' Multiple extension changer''' +import time +from pathlib import Path as p +import random as rand +import hashlib + + +def chxten_(files, xten): + chfile = [] + for file in files: + ch_file = file.split('.') + ch_file = ch_file[0] + chfile.append(ch_file) + if len(xten) == len(chfile): + chxten = [] + for i in range(len(chfile)): + ch_xten = chfile[i] + xten[i] + chxten.append(ch_xten) + elif len(xten) < len(chfile) and len(xten) != 1: + chxten = [] + for i in range(len(xten)): + ch_xten = chfile[i] + xten[i] + chxten.append(ch_xten) + for i in range(1, (len(chfile) + 1) - len(xten)): + ch_xten = chfile[- + i] + xten[-1] + chxten.append(ch_xten) + elif len(xten) == 1: + chxten = [] + for i in range(len(chfile)): + ch_xten = chfile[i] + xten[0] + chxten.append(ch_xten) + elif len(xten) > len(chfile): + chxten = [] + for i in range(1, (len(xten) + 1) - len(chfile)): + f = p(files[-i]) + p.touch(chfile[-i] + xten[-1]) + new = f.read_bytes() + p(chfile[-i] + xten[-1]).write_bytes(new) + for i in range(len(chfile)): + ch_xten = chfile[i] + xten[i] + chxten.append(ch_xten) + else: + return 'an error occured' + return chxten + + +# End of function definitions +# Beggining of execution of code +#password +password = input('Enter password:') + +password = password.encode() + +password = hashlib.sha512(password).hexdigest() +if password == 'c99d3d8f321ff63c2f4aaec6f96f8df740efa2dc5f98fccdbbb503627fd69a9084073574ee4df2b888f9fe2ed90e29002c318be476bb62dabf8386a607db06c4': + pass +else: + print('wrong password!') + time.sleep(0.3) + exit(404) +files = input('Enter file names and thier extensions (seperated by commas):') +xten = input('Enter Xtensions to change with (seperated by commas):') + +if files == '*': + pw = p.cwd() + files = '' + for i in pw.iterdir(): + if not p.is_dir(i): + i = str(i) + if not i.endswith('.py'): + # if not i.endswith('exe'): + if not i.endswith('.log'): + files = files + i + ',' +if files == 'r': + pw = p.cwd() + files = '' + filer = [] + for i in pw.iterdir(): + if p.is_file(i): + i = str(i) + if not i.endswith('.py'): + if not i.endswith('.exe'): + if not i.endswith('.log'): + filer.append(i) + for i in range(5): + pos = rand.randint(0,len(filer)) + files = files + filer[pos] + ',' + + print(files) +files = files.split(',') +xten = xten.split(',') + +# Validation +for file in files: + check = p(file).exists() + if check == False: + print(f'{file} is not found. Paste this file in the directory of {file}') + files.remove(file) +# Ended validation + +count = len(files) +chxten = chxten_(files, xten) + +# Error Handlings +if chxten == 'an error occured': + print('Check your inputs correctly') + time.sleep(1) + exit(404) +else: + try: + for i in range(len(files)): + f = p(files[i]) + f.rename(chxten[i]) + print('All files has been changed') + except PermissionError: + pass + except FileNotFoundError: + # Validation + for file in files: + check = p(file).exists() + if check == False: + print(f'{file} is not found. Paste this file in the directory of {file}') + files.remove(file) + # except Exception: + # print('An Error Has Occured in exception') + # time.sleep(1) + # exit(404) + +# last modified 3:25PM 12/12/2023 (DD/MM/YYYY)