100 Days of Code: Day 2

Tish H.
2 min readJun 9, 2022

--

On Day2 of the #100daysofcode challenge we dive deeper in learning more about manipulating strings and we move onto data types (defining variables differently).

If you haven’t already checked out my previous day, please go and give it a read here.

*100daysofcode Link: https://tidd.ly/3GNwiIt

Exercises & Concepts Learnt

Below are a few of the concepts learnt in Day2 of the course and exercises to practice those concepts. This was definitely a step up from Day 1 in terms of concepts and things to pick up. With heavy focus on maths + data manipulation.

learning datatypes
conversion functions using data types
string to integer conversion & using math operators to calculate an sum
writing a program that calculates BMI from user input
Create a program using maths and f-Strings that tells us how many days, weeks, months we have left if we live until 90 years old.

💡Tip! When tackling exercises, break it down like a story, find where you think variables need to be created in order for values to be stored and think about where manipulation needs to occur.

Day 2 | Project “Tip Calculator”

So todays project is a tip calculator. The programme will ask for the following:

  • how much was the total bill?
  • how much percentage of tip to pay (10, 12 or 15%)
  • how many people is the bill being split between?

Then it will calculate the final bill per a person (rounded to 2 decimal places). You can see below my working solution via running the script.

💡Tip! My calculations are not as good as they used to be 😂, I’d highly recommend writing out maths like this on a piece of paper to help determine where you need to do your calculations in code. It’s a bit like pseudocode.

Check out my GitHub repository for the exercises, concepts & project solution from Day2. This also shows you my failed attempts in my commit history.

*Please note the link provided to the 100daysofcode bootcamp course is affiliated. I will receive a small % from each purchase.

--

--