Skip to content

mishmanners/JediTraining

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JediTraining

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!

Challenge

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

Run my code

See if my code works (I hope it does!).

May the force be with you!

Run it in the cloud

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 🥳

  1. Click the "Code" dropdown above the repository file list
  2. Click the "plus" button to open a Codespace (it should open in a 2 core Codespace; if not make sure you select 2 core)
  3. Press CTRL + backtick on the keyboard (⌘ + backtick on Mac) to open the terminal
  4. Type python JediMindTricks.py into the terminal
  5. You should see the output!

Run it locally

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:

  1. Clone the repository:
git clone https://github.com/mishmanners/JediTraining.git
  1. Change directory to the cloned repository:
cd Jedi-Training
  1. Run the script using Python:
python JediMindTricks.py
  1. The script will output the final transformed sequence of numbers (hopefully :fingers_crossed:)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages