100 Days Of Code Challenge – Level Beginner #1.

Posted in June 1, 2021 by

Categories: Challenges Programming Python

Tags: , , ,

Reading Time: 6 minutes

In this post, I write about challenge I am participating in now. It is the 100 Days of Code Challenge from the Udemy course. The course is divided into few levels. The first level is beginner which will last a couple of days. I will write here a log from every day of beginner level. For other levels, there will be separate articles on this blog. Let us begin πŸ€“ .

About this course and the challenge.

You can find that Udemy course under this link – 100 Days of Code – The Complete Python Pro Bootcamp for 2021.

The author of this course is Dr. Angela Yu. As far as I got, I see she is an excellent instructor. Her linkedin.com profile you can find under this link – Dr. Angela Yu Linkedin Profile.

The course is a 100 days Bootcamp of Python. If you would like to learn this language this course is a great starting point for you.

My level of Python is now somewhere between intermediate and intermediate+ but despite that, I am taking beginner classes because …

Master the basics. Then practice them every day without fail. Small disciplines repeated with consistency every day lead to great achievements gained slowly over time.

John C. Maxwell

So let’s begin πŸ€ͺ …

100 Days Of Code Challenge – Day 1.

In this day I learned basic concepts like variables, string manipulation and basic functions like len, or print 😎 .

I already like this course because we are so far doing exercises in Replit Online IDE.

The last coding challenge in this day was to build a simple band generator. The concept is very simple.

First, we ask the user for the name of the town he grows up in. Then we ask the user for their favorite pet’s name. And finally, we combine these two data into a band name which is printed in the console.

Here is the code of this final coding challengeπŸ‘‡ :

print("Welcome in my 100DaysOfCode Challenge Day 1 final program - Band Name Generator.")
city_grown = input("Which city did you grow up?:\n")
pet_name = input("What was the name of your favorite pet?:\n")
band_name = city_grown + " " + pet_name
print("Your band name could be: " + band_name + "\n")

That is all for day 1 πŸ™‚ .

100 Days Of Code Challenge – Day 2.

This day of code challenge was shorter than previous one.

On this day Angela taught me about data types which are String, Integer, Float, and Boolean. We were making a few exercises on data type conversion and printing variables with fString format.

Additionally, Angela explained mathematical operators in Python and their precedence. We were using the round function to round float numbers to two decimal places.

At the end of day 2, the main code challenge was to create a Tip Calculator. I easily, quickly managed to solve that challenge. Here is my codeπŸ‘‡ :

print("Welcome to tip calculator.")
bill_amount = input("What was the total bill?: ")
perc_tip = input("What percentage tip would you like to give? 10, 12 or 15: ")
people_num = input("How many people to split the bill?: ")

bill_amount_as_float = float(bill_amount)
perc_tip_as_float = float(perc_tip)
perc_tip_as_perc = perc_tip_as_float / 100
people_num_as_int = int(people_num)

bill_total = bill_amount_as_float + (bill_amount_as_float * perc_tip_as_perc)

bill_splited = bill_total / people_num_as_int
bill_splited = "{:.2f}".format(bill_splited)

print(f"Each person should pay: ${bill_splited}")

And that is all for day 2 πŸ™ƒ .

100 Days Of Code Challenge – Day 3.

In this day 3, of coding challenge I was learning about conditional operators like if, elif and else.

Logical operators also were mentioned – or, and, not.

I was doing pizza bill calculator or true love checker among other smaller coding projects 😘 .

The final coding project was to make your own version of Treasure Island text adventure game.

You can check my results by clicking the link below:

  1. My version of Treasure Island Game on Replit – Sports.

Additionally I paste below code of this projectπŸ‘‡ :

print('''
                                                                
                                                                
                                               ,d               
                                               88               
,adPPYba, 8b,dPPYba,   ,adPPYba,  8b,dPPYba, MM88MMM ,adPPYba,  
I8[    "" 88P'    "8a a8"     "8a 88P'   "Y8   88    I8[    ""  
 `"Y8ba,  88       d8 8b       d8 88           88     `"Y8ba,   
aa    ]8I 88b,   ,a8" "8a,   ,a8" 88           88,   aa    ]8I  
`"YbbdP"' 88`YbbdP"'   `"YbbdP"'  88           "Y888 `"YbbdP"'  
          88                                                    
          88                                                   
''')
print("Welcome to my version of Treasure Island.")
print("Your mission is to win the thriathlone.") 

print("You are running. You goal is to finish 20 km run but you encounter crossroad. You can go left or right. What is your choice?")
choice = input("Left or Right: ").lower()
if choice == "left":
    print("It is going good. You run the last 20 km and you encounter swimming part. You are in front of a river. You can swim or wait and rest a bit. What do you do?")
    choice = input("Swim or Wait: ").lower()
    if choice == "wait":
        print("You wait and rest a bit and you swimm across the river.")
        print("Now it is a bicycyle part. You go by bicicle a few kilometers but you puncture the tire.")
        print("You must change the inner tube in the tire. You have 3 options. Red tire, Blue tire and Yello tire. Which one you choose?")
        choice = input("Yellow, Blue or Red: ").lower()
        if choice == "blue":
          print("After riding a few more km your bicycle break. You don't finish the race. Game Over.")
        elif choice == "red":
          print("After riding a few more km you feel so dihedrated that you must stop your race. Where are people with water, you ask yourself? You don't finish the race. Game over.")
        elif choice == "yellow":
          print("You ride very smoothly and you finish the race. You are not first but nevertheless completing thriathlone is a great accomplishment in your life. You can congratulate yourself. You win.")
        else:
          print("You choosed wrong option. Game over.")
    elif choice == "swim":
      print("You try to swim but after a few minutes you feel cramp in the leg. The paramedics must help you. You didn't finish the race. Game over.")
    else:
      print("You choosed wrong option. Game over.")
elif choice == "right":
  print("You picked wrong road. You didn't finish the race. Game Over!")
else:
  print("You choosed wrong option. Game over.")

And that is all for day 3 πŸ™‚ .

100 Days Of Code Challenge – Day 4.

This day of code challenge was quite easy. Today I learned about lists which are essential in programmer work.

Angela taught me about the random module and how to create random integer and float numbers. It is a very useful skill and I used it a lot in coding challenges at this day.

Here is additional resource about pseudo-random numbers from Khan Academy 🌳 :

I also learned about len and split functions which work really well with lists.

On this coding challenge day, I was challenged with “Toss a Coin Game” and “Who Pay for the Bill Game” but the final coding challenge was about creating “Rock, Paper, and Scissors Game” πŸ€“ .

If you don’t know the rules of this game here you have link with explanation:

You can play in the final game that I created by clicking in the link below:

The full code of this game you can find below πŸ‘‡ :

import random

rock = '''
    _______
---'   ____)
      (_____)
      (_____)
      (____)
---.__(___)
'''

paper = '''
    _______
---'   ____)____
          ______)
          _______)
         _______)
---.__________)
'''

scissors = '''
    _______
---'   ____)____
          ______)
       __________)
      (____)
---.__(___)
'''

list_of_actions = [rock, paper, scissors]

print("What do you choose? Type 0 for Rock, 1 for Paper and 2 for Scissors.")
your_choice = int(input(": "))
if your_choice >= 0 and your_choice <= 2:
  print(list_of_actions[your_choice])
  computer_choice_int = random.randint(0, 2)
  computer_choice = list_of_actions[computer_choice_int]
  print("Computer choose: ")
  print(computer_choice)

  if your_choice == 0 and computer_choice_int == 1:
    print("Computer wins.")
  elif your_choice == 0 and computer_choice_int == 2:
    print("You win.")
  elif your_choice == 1 and computer_choice_int == 0:
    print("You win.")
  elif your_choice == 1 and computer_choice_int == 2:
    print("Computer wins.")
  elif your_choice == 2 and computer_choice_int == 1:
    print("You win.")
  elif your_choice == 2 and computer_choice_int == 0:
    print("Computer wins.")
  elif your_choice == computer_choice_int:
    print("It is a draw.")
  else:
    print("Something went wrong. Contact admin.")
else:  
  print("Invalid choice. You can choose only number 0, 1 or 2. Game over.")

And that is all for day 4 πŸ™ƒ .

Continuation.

This article is already to long so I decided I will divide beginner part of this challenge to a few separate articles.

The next part 2, you will be able to find by clicking the link below.

If the link doesn’t work yet it means that this article hasn’t been created yet. But it will be soon … 😎

Thank you for reading and have a great day πŸ‘ .



Leave a Reply

Your email address will not be published. Required fields are marked *

1 × 3 =