Day 3: 100 Days of Code

Day 3: 100 Days of Code

Python

Day 3 was about:

Conditionals IF/ELIF/ELSE

There are two ways to put things in control flow

  1. Multiple if else blocks. If we apply more than one if else so every if else will be executes.
  2. if elif else. In this way, only true condition will be executes.

While, these are the operators we use in if else statements for conditions:

comparison operators: <,>,>=,<=,==,!=

⚠️ Single equal sign = is use for assigning in python and double equal sign == is use to compare value on left side with the value on right side.

Modulo: It gives us the remainder after dividing two numbers.

Logical Operators

We have three logical operators in python i.e., and, or, not

Exercises

We have done 5 exercises on day 3

  1. Odd or Even/Modulo
  2. BMI 2.0
  3. Leap Year
  4. Pizza order Pratice
  5. Love Calculator

Head over to my GitHub repository to see their codes.

Project

I have built treasure island game. If's simple game where we have to find treasure boy. The is in GitHub repository.

Bonus: As we know that we can use single or double quotes in print function but if we want to to print more than one lines we can also use triple quotes.

Flow chart comes into handy when we are working with conditional statements. The code writing becomes so easy when we first draw the flow chart of our problem. And for drawing flow chart is draw.io is best.