diff --git a/BrowserHistory/rock_paper_scissors.py b/BrowserHistory/rock_paper_scissors.py index c6fb00102d6..a9c4efa0616 100644 --- a/BrowserHistory/rock_paper_scissors.py +++ b/BrowserHistory/rock_paper_scissors.py @@ -1,5 +1,6 @@ """ -Rock, Paper, Scissors Game (CLI Version) +Triple Round : Rock, Paper, Scissors Game (CLI Version) +Final round is the Winning Round Author: Your Name """ @@ -38,10 +39,13 @@ def decide_winner(player, computer): def main(): """Main function to play the game.""" - user_choice = get_user_choice() - computer_choice = get_computer_choice() - print(f"Computer chose: {computer_choice}") - print(decide_winner(user_choice, computer_choice)) + for i in range(1, 4): + print(f"round -> {i}\n") + user_choice = get_user_choice() + computer_choice = get_computer_choice() + print(f"Computer chose: {computer_choice}") + + print(f"Final result : {decide_winner(user_choice, computer_choice)}") if __name__ == "__main__": diff --git a/BrowserHistory/tests/test_browser_history.py b/BrowserHistory/tests/test_browser_history.py index b1e0af744f7..fc07e86e0fc 100644 --- a/BrowserHistory/tests/test_browser_history.py +++ b/BrowserHistory/tests/test_browser_history.py @@ -88,6 +88,6 @@ def test_complex_navigation(self): # Verify we can't go forward to cleared history self.assertEqual(self.browser.forward(1), "page4.com") - +# starting point of code if __name__ == "__main__": unittest.main() diff --git a/Cat/cat.py b/Cat/cat.py index 0c9ba120255..3024b35ef0a 100644 --- a/Cat/cat.py +++ b/Cat/cat.py @@ -47,6 +47,7 @@ def no_files(): # Graceful exit for Ctrl + C, Ctrl + D except KeyboardInterrupt: exit() + # exit when no data found in file except EOFError: exit() diff --git a/oryx-build-commands.txt b/oryx-build-commands.txt new file mode 100644 index 00000000000..d647bdf7fdf --- /dev/null +++ b/oryx-build-commands.txt @@ -0,0 +1,2 @@ +PlatformWithVersion=Python +BuildCommands=conda env create --file environment.yml --prefix ./venv --quiet diff --git a/requirements_with_versions.txt b/requirements_with_versions.txt index e9829426e31..957c1baa9b6 100644 --- a/requirements_with_versions.txt +++ b/requirements_with_versions.txt @@ -81,7 +81,7 @@ Unidecode==1.4.0 Ball==0.2.9 pynput==1.8.1 gTTS==2.5.4 -ccxt==4.5.20 +ccxt==4.5.21 fitz==0.0.1.dev2 fastapi==0.121.1 Django==5.2.7 diff --git a/sha1.py b/sha1.py index 16a61e0ed75..1912a73751c 100644 --- a/sha1.py +++ b/sha1.py @@ -132,5 +132,6 @@ def main(): print(SHA1Hash(hash_input).final_hash()) +# starting point of code if __name__ == "__main__": main() diff --git a/voice.py b/voice.py index 48b01b8b308..20d7f358f1c 100644 --- a/voice.py +++ b/voice.py @@ -1,14 +1,20 @@ +# modules for use of voice from gtts import gTTS +from colorama import Fore import os # Define the text you want to convert to speech text = "Hello! This is a sample text to convert to speech." -# Create a gTTS object -tts = gTTS(text=text, lang="en") +# Exception Handaled. +try: + # Create a gTTS object + tts = gTTS(text=text, lang="en") -# Save the audio file -tts.save("output.mp3") + # Save the audio file in mp3 format + tts.save("output.mp3") -# Play the audio file -os.system("start output.mp3") + # Play the audio file from system + os.system("start output.mp3") +except Exception as e: + print(Fore.RED, e, Fore.RESET) \ No newline at end of file diff --git a/vowel remover function.py b/vowel remover function.py index 5af2ff5f01e..1942c30d6ae 100644 --- a/vowel remover function.py +++ b/vowel remover function.py @@ -4,4 +4,7 @@ def vowel_remover(text): if l.lower() not in "aeiou": string += l return string -print(vowel_remover("hello world!")) + +# this code runes on only this file +if __name__=="__main__": + print(vowel_remover("hello world!")) diff --git a/youtubedownloader.py b/youtubedownloader.py index b5667950a27..80362a737f3 100644 --- a/youtubedownloader.py +++ b/youtubedownloader.py @@ -20,31 +20,33 @@ def download(): except Exception: messagebox.showerror("Error", "An error occurred while downloading the video.") + +# This code runes on only this file +if __name__=="__main__": + root = Tk() + root.title("YouTube Downloader") + root.geometry("780x500+200+200") + root.configure(bg="olivedrab1") + root.resizable(False, False) + # Label widgets + introlable = Label( + root, + text="YouTube Video Downloader", + width=30, + relief="ridge", + bd=4, + font=("chiller", 26, "italic bold"), + fg="red", + ) + introlable.place(x=35, y=20) -root = Tk() -root.title("YouTube Downloader") -root.geometry("780x500+200+200") -root.configure(bg="olivedrab1") -root.resizable(False, False) -# Label widgets -introlable = Label( - root, - text="YouTube Video Downloader", - width=30, - relief="ridge", - bd=4, - font=("chiller", 26, "italic bold"), - fg="red", -) -introlable.place(x=35, y=20) + Label(root, text="Enter YouTube Link", font=("sans-serif", 16), bg="olivedrab1").place( + x=40, y=150 + ) -Label(root, text="Enter YouTube Link", font=("sans-serif", 16), bg="olivedrab1").place( - x=40, y=150 -) + url_box = Entry(root, font=("arial", 30), width=30) + url_box.place(x=40, y=180) -url_box = Entry(root, font=("arial", 30), width=30) -url_box.place(x=40, y=180) - -btn = Button(root, text="DOWNLOAD", font=("sans-serif", 25), command=threading) -btn.place(x=270, y=240) -root.mainloop() + btn = Button(root, text="DOWNLOAD", font=("sans-serif", 25), command=threading) + btn.place(x=270, y=240) + root.mainloop()