#100DaysOfCoding – Day 04 – Challenge 01

#100DaysOfCode #100daysofcodechallenge

Just finished the Day 04 challenge about writing a virtual coin toss Python code. Don’t have a coin in hand? Why not try this Virtual Toss Coin program I’ve just created?

https://replit.com/@AllscanTwelve/day-4-1-exercise#main.py

Here is the video in action:

Virtual Toss Coin Program

#100DaysOfCoding – Day 03 – Challenge 06

So here is the last part of the exercise for day 3 of #100daysOfCoding or #100DaysOfCodingChallenge

The task is to create Python code according to the flow of this story.

There will be an introductory message that says “Welcome to Treasure Island.”, then followed by “Your mission is to find the treasure.”.

After that, you’ll be asked in which direction you would like to go, left or right?

If you choose left, you go to the next level, otherwise, the game is over and with a message that says “You’ve entered the wrong direction. The game is now over.”.

For as long as you choose the right choices, you’ll jump to the next level of choices until you finally win the game.

Here is the flowchart, to give you an idea, of how this game works:

Another challenge here is to capture the user input. As you’ll notice, left or right choices are in lowercase and the user might have typed the answer in sentence case so, this is something you need to make sure you catch. And of course, if the user intentionally typed something else that is not in the choices, you’ve got to inform the user something like the following:

For entering the wrong direction that is not in the choices = “You’ve entered the wrong direction. The game is now over.”

For entering the wrong action that is not in the choices = “You’ve entered the wrong action. The game is now over!”

For entering the wrong colour that is not in the choices = “You chose a door that doesn’t exist. The game is now over!”

So here is my code:

Here is the link if you want to see it live in action:

Have a great day! Cheers

iVisa.com

#100DaysOfCoding – Day 03 – Challenge 03, 04 and 05

So much to learn on day 03 of the #100DaysOfCoding and I’m not yet done.

Day 3 is about Control Flow and Logical Operators. I’ve been busy at work, so, I’ll continue this tomorrow.

Then I challenged myself to upgrade the BIM Calculator Python code I did on the lesson by adding more options for the user to input the height either in Metric or in the English unit of measure.

See it in action here:

Positive SSL