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/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!"))