Skip to main content

365 DAYS OF CODE - DAY 3

DAY 3 THOUGHT PROCESS

Conditional statement; if/else, draw.io is great for drawing flowcharts, spacing and indentation are very important, comparison operators (i.e., <, >, <=, >=, ==, !=), modulo operator (i.e., %) gives the remainder of a division, nested if/else, if/elif/else, we can use as many elif as we can in between the if-else statement.

I was not very confident about the bmi calculator but I got it right although our approaches were different. I guess coding really builds up our logic.

We also learned multiple if statements in succession, indentation has to be a multiple of 4, logical operators, get ascii art at ascii.co.uk/art/treasure (hearing it for the first time), using 3 single quotes at the beginning and end of a multi block string, the “\” is used as an escape symbol in Python, lower function (.lower()),

I did all the coding exercises today except the Treasure Island Game (Maybe I will look into it someday, Maybe). I failed to read the description of the Python Pizza Deliveries Exercise (I will pay more attention next time). I tried rushing through the exercise today but realized I should not. I should take my time and think through every exercise. My excuse is that I have assignments and other stuff that needs my attention. I can not make coding top priority for now because there is school. Maybe I could during the weekends. Or maybe I should overall. I will think on it for a while.

Can you tell I am pretty tired today??

Good Night. :)

 

Comments

Popular posts from this blog

365 DAYS OF CODE - DAY 0

DAY 0 THOUGHT PROCESS Day Zero of the 365 days of code highlights my state of mind before the actual start of the program. Yes, it is a program. A program I set for myself to make sure I actually put in the work on a daily. I have tried coding before but have never been quite consistent with it. A friend advised me to try coding daily if I really wanted to be great at it someday. He also stated that it would take a long time and I should be prepared for it. During the same period, I noticed he was on a year's worth streak of chess which made me realize I could also do the same but with coding. I signed up for the 100 days of code course on Udemy and plan on starting my coding journey with Angela Yu and the thousands of students also taking the course. I also drafted my own copy of the pledge, copied and modified from the 100 Days of Python Pledge from the course materials. It is currently pasted on my wall as a constant reminder. Finally, I will also be recording my process here...

365 DAYS OF CODE - DAY 13

What is wrong with this code?? Can you tell what it does?? import art n1 = 0 n2 = 0 selected_operation = "" solution = 0 def add (n1, n2): return n1 + n2 def subtract (n1, n2): return n1 - n2 def multiply (n1, n2): return n1 * n2 def divide (n1, n2): return n1 / n2 operations = { "+" : add, "-" : subtract, "*" : multiply, "/" : divide } def rest_of_calculation (): print ( "+ \n - \n * \n /" ) selected_operation = input ( "Pick an operation: " ) n2 = float ( input ( "What is the next number?: " )) for key in operations: if key == selected_operation: solution = operations[key](n1, n2) print ( f" { n1 } { key } { n2 } = { solution } " ) print (art.logo) n1 = float ( input ( "What is the first number?: " )) rest_of_calculation() while True : new_calculation = input ( f"Type 'y' to continue calcu...

365 DAYS OF CODE - DAY 27

  Watched a friend write these: from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine def what_to_do_next (): pass def handle_prompt (prompt): if prompt == "off" : coffee_on = False return elif prompt == "report" : report = coffee_maker.report() print (report) coffee_maker = CoffeeMaker() coffee_on = True while coffee_on == True : prompt = input ( "What would you like? (espresso/latte/cappuccino): " ) handle_prompt(prompt)