├── LICENSE ├── Python ├── unit_01_guess_the_number │ ├── Screenshot-Guess the Number.png │ └── guess_the_number.py └── unit_02_rock_paper_scissors │ ├── Screenshot-Rock-Paper-Scissors.png │ └── rock_paper_scissors.py ├── README.md └── TypeScript └── unit_01_typescript_basics └── typescript_basics.ts /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Shavinda Dizz / Nova 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Python/unit_01_guess_the_number/Screenshot-Guess the Number.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyferlink/skills-training-cross-lang/fdbf5e9fca4f17bef23c2873fdcca8e1de7b0d4a/Python/unit_01_guess_the_number/Screenshot-Guess the Number.png -------------------------------------------------------------------------------- /Python/unit_01_guess_the_number/guess_the_number.py: -------------------------------------------------------------------------------- 1 | # Here is a online Python compiler (interpreter) to run Python online. 2 | # https://www.programiz.com/python-programming/online-compiler/ 3 | # ------------------------------------------------------------------- 4 | # Unit 01 : Guess the Number 5 | # ------------------------------------------------------------------- 6 | 7 | import random 8 | 9 | def guess_the_number(): 10 | # Generate a random number between 1 and 100 11 | secret_number = random.randint(1, 100) 12 | max_attempts = 10 # Maximum attempts allowed 13 | attempts = 0 14 | 15 | print("Welcome to 'Guess the Number'!") 16 | print("I'm thinking of a number between 1 and 100.") 17 | 18 | while attempts < max_attempts: 19 | try: 20 | # Prompt the player to enter a guess 21 | player_guess = int(input("Enter your guess: ")) 22 | except ValueError: 23 | print("Please enter a valid integer.") 24 | continue 25 | 26 | attempts += 1 27 | 28 | # Check if the player's guess is correct 29 | if player_guess == secret_number: 30 | print(f"Congratulations! You guessed it in {attempts} attempts.") 31 | return 32 | elif player_guess < secret_number: 33 | print("Too low. Try again!") 34 | else: 35 | print("Too high. Try again!") 36 | 37 | print(f"Sorry, you've used all {max_attempts} attempts. The correct number was {secret_number}.") 38 | 39 | guess_the_number() 40 | -------------------------------------------------------------------------------- /Python/unit_02_rock_paper_scissors/Screenshot-Rock-Paper-Scissors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyferlink/skills-training-cross-lang/fdbf5e9fca4f17bef23c2873fdcca8e1de7b0d4a/Python/unit_02_rock_paper_scissors/Screenshot-Rock-Paper-Scissors.png -------------------------------------------------------------------------------- /Python/unit_02_rock_paper_scissors/rock_paper_scissors.py: -------------------------------------------------------------------------------- 1 | # Here is a online Python compiler (interpreter) to run Python online. 2 | # https://www.programiz.com/python-programming/online-compiler/ 3 | # ------------------------------------------------------------------- 4 | # Unit 02 : Rock, Paper, Scissors 5 | # ------------------------------------------------------------------- 6 | 7 | import random 8 | 9 | def rock_paper_scissors(): 10 | # Define choices for the game 11 | #choices = ["rock", "paper", "scissors"] 12 | choices = ["r" , "rock", "p" , "paper", "s" , "scissors"] 13 | score_player = 0 14 | score_computer = 0 15 | 16 | print("Welcome to Rock, Paper, Scissors!") 17 | print("Type 'exit' to quit the game.") 18 | print("-------------------------------") 19 | 20 | while True: 21 | player_choice = input("Choose rock, paper, or scissors: ").lower() 22 | 23 | # Exit condition 24 | if player_choice == "exit": 25 | break 26 | 27 | if player_choice not in choices: 28 | print("Invalid choice. Please choose rock, paper, or scissors.") 29 | continue 30 | 31 | # Computer's random choice 32 | computer_choice = random.choice(choices) 33 | 34 | if computer_choice == "r": 35 | computer_choice = "rock" 36 | elif computer_choice == "s": 37 | computer_choice = "scissors" 38 | elif computer_choice == "p": 39 | computer_choice = "paper" 40 | 41 | print(f"Computer chose {computer_choice}") 42 | 43 | 44 | # Determine the winner 45 | if player_choice == computer_choice: 46 | print("It's a tie!") 47 | elif ((player_choice == "rock" or player_choice == "r") and computer_choice == "scissors") or \ 48 | ((player_choice == "scissors" or player_choice == "s") and computer_choice == "paper") or \ 49 | ((player_choice == "paper" or player_choice == "p") and computer_choice == "rock"): 50 | print("You win!") 51 | score_player += 1 52 | else: 53 | print("Computer wins!") 54 | score_computer += 1 55 | 56 | print(f"Score - You: {score_player}, Computer: {score_computer}") 57 | print("-------------------------------") 58 | 59 | rock_paper_scissors() 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |