DEV Community

Cover image for May the Fourth Be with You: Jedi Training Challenge in Python
Rain Leander
Rain Leander

Posted on

4 1

May the Fourth Be with You: Jedi Training Challenge in Python

May the Fourth Be with You: Jedi Training Challenge in Python

Greetings, Jedi Padawans, fellow coders, and esteemed Jedi Knights! Today, we celebrate Star Wars Day and embark on an exciting journey through the galaxy of Python programming.

Inspired by the Jedi Training Challenge blog post, we have created a Python script that will test your Jedi coding skills and bring balance to the Force.

Come along as we explore the May the Fourth GitHub repository and learn how to wield the power of Python like a true Jedi Master.

Jedi Training Challenge

In the Star Wars universe, Jedi Knights are skilled in the use of the Force, a mystical energy that they can manipulate to achieve various abilities. To simulate Jedi training, we have created a Python program that generates a sequence of numbers and applies various transformations to them using... the power of code!

The mission is simple:

  1. Generate a sequence of 10 random numbers between 1 and 10.
  2. 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
  3. Print the final sequence to the console.

Our Python script, may.py, accomplishes this task with ease. Check out the May the Fourth GitHub repository to see the script in action and learn how to run it on your local machine.

Join the Rebellion

The Force is strong with this repository, but we believe it can become even stronger with your help. We invite you to join the rebellion and contribute your Jedi coding skills to improve and expand the project. The README.md file in the repository provides detailed instructions on how to collaborate, create pull requests, and contribute your unique touch to this Python-powered Jedi adventure.

The Force Will Be with You... Always

With the power of Python and the guidance of the Force, you can become a true Jedi coder. Take the Jedi Training Challenge, explore the May the Fourth GitHub repository, and collaborate with your fellow Jedi Padawans to create a Python script that will bring balance to the galaxy.

Remember, the Force will be with you... always.

May the fourth be with you!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Retry later