Code for the Jedi Training challenge posted on DEV as part of the May the 4th (Star Wars day) celebrations.
Check out the code, and feel free to use it!
The instructions from the DEV challenge are as follows:
Write a program that generates a sequence of 10 random numbers between 1 and 10. Use the Force (code) to apply the following transformations to the sequence:
- Multiply every even number by 2
- Add 5 to every odd number
- Replace any number greater than 10 with 1
- Print the final sequence to the console
See if my code works (I hope it does!).
May the force be with you!
Thanks to Dylan for writing the .devcotaniner
for you to run this in a Codespace. Remember, all GitHub users get 60 hours of free Codespace usage every single month 🥳
- Click the "Code" dropdown above the repository file list
- Click the "plus" button to open a Codespace (it should open in a 2 core Codespace; if not make sure you select 2 core)
- Press CTRL + backtick on the keyboard (⌘ + backtick on Mac) to open the terminal
- Type
python JediMindTricks.py
into the terminal - You should see the output!
Thanks to rainleander for the idea of adding this section, and for the instructions on how to do it!.
To run the script, follow these steps:
- Clone the repository:
git clone https://github.com/mishmanners/JediTraining.git
- Change directory to the cloned repository:
cd Jedi-Training
- Run the script using Python:
python JediMindTricks.py
- The script will output the final transformed sequence of numbers (hopefully :fingers_crossed:)