10 Python Code Challenges to Try During Pride

3 months ago 120
ARTICLE AD

Completing code challenges, bite-sized problems that can be solved with code, is an excellent way to sharpen specific coding skills and concepts — not to mention, code challenges are fun. In honor of Pride Month this June, we’re giving you a list of code challenges to try that all relate to uplifting the LGBTQ+ community and its allies. 

These coding challenges will give you a good mix of Python concepts to practice, like lists, strings, conditionals, and structures. Depending on your experience level, some of these challenges only take a few minutes to complete, while the more difficult ones might take a couple days. You may want to revisit a Python course to review (we’ve recommended the relevant Python courses to try along the way). 

As you’ll see, these are open-ended challenges and we’re not providing solutions. That’s because we want to give you a chance to practice key coding skills and apply your coding knowledge to real-world scenarios. We hope you feel inspired by all of the ways you can use code to give back to the communities and causes that you care about. Happy Pride and happy coding!

1. Affirmation Engine

Write a Python program that takes a user’s pronouns as input and returns a message that includes their pronouns and a statement of respect for their gender identity. An example of a message could be: “Thank you for sharing that your pronouns are {pronouns}. We wholeheartedly respect and affirm your gender identity, and appreciate your help in building an inclusive environment where everyone feels valued and accepted.

2. STEM Icons Sorter

Create a Python program that takes a list of LGBTQ+ historical figures as input and returns a new list with the terms sorted alphabetically. Want to brush up on your queer history? Learn about trailblazing LGBTQ+ figures in our free course LGBTQ+ STEM Icons.

3. ASCII Artist

In the beginner-friendly course Learn Python 3, you’ll get introduced to ASCII art, a type of text-based visual art that uses individual characters to create pictures and diagrams. Write a Python program that prints “PRIDE” in ASCII block letters. You can reference the complete ASCII alphabet using this chart.

4. Pride March Countdown

Write a Python program that calculates the number of days, hours, and minutes remaining until the annual NYC Pride March, which starts on June 25 at 12 pm EDT. The program should display the countdown in a user-friendly format. For a refresher on working with date time data in Python, read this article

5. Acronym Explainer

Create a switch loop that prints the terms represented in the acronym LGBTQ+, which are: lesbian, gay, bisexual, transgender, queer, and non-straight/non-cisgender identities.

6. Rainbow Message Generator

You are given a message, “Code with pride!” that needs to be transformed into a rainbow-themed string where each letter is a different color in the LGBTQ+ Pride flag. Your task is to write a Python function that takes the message as input and returns the rainbow version of the message. Hot tip: You can use ANSI escape codes to apply color to text in Python.

7. Pronoun Practice Chatbot

Develop a simple chatbot that helps you practice using someone’s pronouns in different contexts. This code challenge is the most advanced one in the bunch, but don’t be intimidated. In the skill path Build Chatbots with Python, you’ll learn how to code rule-based, retrieval-based, and generative chatbots. The best part is you don’t need coding experience to get started — we’ll teach you to code with Python from scratch. 

8. Research LGBTQ+ Representation

Build a program that reads a dataset (you can use this pre-made dataset) and analyzes the representation of LGBTQ+ characters in cartoons. The program should calculate and display statistics, like any trends or changes in representation over the years. If you’re new to data science, check out the course Getting Started with Python for Data Science. You’ll get to work hands-on with real datasets in the course, and learn to use Jupyter Notebook, an industry-standard data analytics platform.

9. Pronoun Reminder

Create a simple Python program that takes a user’s name and pronouns as input and then reminds the user to use those pronouns in a sentence. For example, if the user inputs “Alex” and “they/them,” the program should output a message like, “Alex uses they/them pronouns!” You’ll learn how to assign variables with user input in Learn Python 3.

10. Inclusive Language Checker

Develop a Python program that checks a given text for the use of inclusive language. The program should identify words or phrases that might be considered exclusive or insensitive and suggest more inclusive alternatives. For example, it could suggest replacing “guys” with “folks” or “y’all.” This exercise will help you practice string manipulation and dictionary data structures. To learn more about how computers work with human language, check out the path Apply Natural Language Processing with Python.

Want even more Python ideas? Try these Python code challenges for beginners, or work your way up to advanced coding challenges. You can also review these code challenges, which are all based on real-world technical interviews. If you feel like you’ve got a handle on code challenges, be sure to check out our library of Python projects that you can complete for practice or your professional portfolio.

This blog was originally published in June 2023 and has been updated to include additional Python challenges.

Subscribe for news, tips, and more

Read Entire Article