Coding Challenge #01: Create a program that swaps the values of two variables.

Coding Challenge #01: Create a program that swaps the values of two variables.

·

3 min read

Earlier this year, Women Who Code launched its WWCode Days of Code Challenge 2024. Participants could choose challenges ranging from machine learning and mobile to Python, cloud, data, and other emerging technologies.

I enthusiastically joined the Women Who Code Python community for their daily coding challenges. This blog series of mine named, "Coding Challenge" will serve as my documentation and accountability to consistency.

To enhance the experience for all WWCode Days of Code Challenge 2024 participants, I also crafted a nifty "checklist" or tracker. Excited to share that it's already making waves within the community! Check it out here: https://lnkd.in/dPuX7_qc

I've also published an article about Step-by-step guide on how to solve daily coding challenges.

Python Days of Code Challenge - Day 1

How It Works:

  • 60 Days, 60 Questions: Dive into daily Python challenges, each marking a step closer to coding mastery. You can start anytime in between as well!

Learning Together:

  • Share your solutions, ask questions, and connect with fellow coders in this thread or on social media (Twitter, LinkedIn) - or Github!

  • Don't forget to tag us @WWCodePython or use the hashtags #WomenWhoCodePython #PythonDaysofCode so we can celebrate your achievements!

Bonus:

  • React to today’s question if you’d like us to solve this LIVE in our upcoming Python Code Jam Sessions

Today's Challenge:

  • Create a program that swaps the values of two variables.

Solution

# Challenge: Create a program that swaps the values of two variables.

print("                                             ")
variableOne = input("Type your first random variable: ")
variableTwo = input("Type your second random variable: ")

print("                                             ")
print("These are your random variables BEFORE swapping")
print("First random variable: ", variableOne)
print("Second random variable: ", variableTwo)


# Swappin'

temporaryHolder = variableOne
variableOne = variableTwo
variableTwo = temporaryHolder

print("                                             ")
print("These are your random variables AFTER swapping")
print("First random variable: ", variableOne)
print("Second random variable: ", variableTwo)
print("                                             ")

Goals I achieved

Daily goals:

  • [x] Code Day 1

  • [x] Write an awesome commit message and push your code!

  • [x] Continue writing on your documentation.

  • [x] Share your wins!

  • [x] Help someone on Slack. Give feedback, share resources, be a rubber ducky.

  • [x] Take care of yourself: pause, stretch, hydrate. More on WWCode Code of Balance.

Weekly goals:

  • [x] Send appreciation message to a WWCode volunteer or member. See the photo above.

I hope you learned something from this blog. If you have, show your support by clicking heart or like, share this article as a conversation starter and join my newsletter so that we can continue learning together and you won’t miss any future posts.

Thanks for reading until the end! If you have any questions or feedback, feel free to leave a comment.

Did you find this article valuable?

Support anj by becoming a sponsor. Any amount is appreciated!