Code Monkey home page Code Monkey logo

100-days-of-code-in-python's Introduction

100-days-of-code-in-python

Udemy Angela Yu's course that has 100 projects for students to make each day with classes with duration of 1~2 hours each day.
This repository will store all the related projects. If you are intrested in any code files, please run the code in an IDE for python, although i recommend running it in replit as some modules are imported based on the website.
Below is my summary of what I've learned everyday and the link to fork the project in Repl.it(Online IDE):

Day 1 (https://repl.it/@LeeRen1/D1-Band-name-generatorPOTD):
A band name generator from the input of users of their country and a random pet name.

  1. Used the print function, input function , and creating a variable.
  2. Learned about commenting
  3. Learned that \n brings the cursor/content to the next line in the same print function

Day 2 (https://repl.it/@LeeRen1/D24-Tip-calculator-startPOTD):
Created a simple calculator that takes in input of the total bill, percentage of tips to be given and the amount of people to split the bill.

  1. Applied the f string(found it really convenient)
  2. Reminded me that inputs are in string data type and has to be converted into float/integers before dong any calculations
  3. Reminded me how to round off with a specified decimal number rounding_off=Round(2.666666,2) = 2.66

Day 3 (https://repl.it/@LeeRen1/D36-Treasure-islandPOTD):
Created a storytelling like treasure island adventure where each steps u take lead to different outcomes.

  1. Applied ASCII Art (figures made by numbers and symbols) via: https://ascii.co.uk/art
  2. Learned if/elif/else statements & nested if/elif/else & multiple ifs
  3. Reminded me that indentation is important in python
  4. Had fun! πŸ˜†

Day 4 (https://repl.it/@LeeRen1/D44-rock-paper-scissors-POTD):
Created a simple rock-paper-scissors gameπŸ‘ŠπŸ€šβœŒ where the computer's move is randomly generated using the random.choice after putting all moves into a list and selecting randomly.

  1. Overall,learned about lists and how flexible it is whether it is to extend the list, replacing the item, choose a specific item with index starting from 0 from front and -1 from back, extending the list with another list from input and more
  2. Learned that nested list and list_name[1][1] means choosing the second nested list in the general list and then choosing the second item from the selected list.
  3. Revised if/elif/else statements and nested ifs
  4. Learned about the python random module and differentiating between random.randint(starting index, ending index)/random.float()/random.choice(list_name)
  5. Aware of index error and in most situation the index has to -1 since the computer starts counting from 0

Day 5 (https://repl.it/@LeeRen1/D55-Password-generatorPOTD#main.py):
Created a password generator that takes the user input for number of lettters/symbols/numbers wanted in the password then generated two types of password, first is following the sequence where it goes from letters to numbers and the second harder password is to shuffle the sequence od the password so that there is no specific pattern to ensure maximum security.πŸ”’

  1. Learned the fundamentals of for loops and for loop with a rangefor x in range(start, end, step/gap)
  2. Learned that I cant shuffle strings with the random.shuffle but i can shuffle a list!
  3. Learned how to convert a list into a string (line 46-49)
  4. Learned the logic behind for loops and it took my some time to finally understand the concept.😡 Definitely need more practice with the algorithm and structure

Day 6
(https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Maze&url=worlds%2Ftutorial_en%2Fmaze1.json):
Applied while loops in the website Reeborg's World to solve the maze challenge where the robot spins at every move and you have to reach to the flag without hitting the walls.(The tip was to follow the right side)

  1. Code for: Hurdle 1 to 4 and POTD:MAZE in the file(two different challenges)
  2. Learned about while loops where it will continue to execute if the condition is true
  3. Learned to differentiate when to use for loops(To iterate/do something with each item in a list) and while loop(do the whole code block when the condition is true)
  4. Realized that I can use tab for indentation and there is an argument whether programmers should use tabs or 4 spaces to indent.(Stats shows that programmers that use spaces has a higher average salary and I have no idea why🀣)
  5. Learned to nest if statements into while loops
  6. Learned about creating functions and calling them
  7. Had fun and headache at the same time.

Day 7 (https://repl.it/@LeeRen1/D75-HangmanPOTD#main.py):
Built the hangman game. User has to guess a word and has limited chances.

  1. Learned how to import modules and import the list/variables into the main file.
  2. Reminded me the way to apply while and for loop
  3. Had to figure out the logic step by step and focus on the indentation
  4. Learned "in" to check if a statement is true If x in y

Day 8 (https://repl.it/@LeeRen1/D84-caesar-cipherPOTD#main.py):
Created a program that can encrpyt or decrypt the user's input based on the number of shift they enter(move alphabets front or back). The encoded word can be decoded if the shift is the same.
(For example: To encode: Word=hello shift=5 > encoded word=mjqqt(shifted behind 5 alphabets) To decode: Word=mjqqt, shift=5(same shift amount) > decoded word=hello)

  1. Applied functions, if-else statements, while loops, for loops, and many more that I learned in the past few days
  2. Reminded me how to import variables from another file(the ASCII art in this case)
  3. Reminded me of the concept of modulo "%"
  4. Reminded me of the logic behind for loops and used it to debug the program
  5. Learned about parameters and arguments, functions, functions with more than one inputs, the difference between positional arguments and keyword arguments
  6. Needed to review the code several times to understand the logic behind..

Day 9 (https://repl.it/@LeeRen1/D9-blind-auction-startPOTD#main.py):
Created a program based on the concept of a silent auction where the concept is that nobody knows how much the bidders has bid and at the end of the auctionn the bidder with highest bid wins!

  1. Learned about dictionaries, {key : value, key : value}, Adding another key+value, Edit a key to another value, Nesting dictionaries in list and vice versa, Nesting dict .in dict.,Looping through dict., access value from nested dict. and more.
  2. Reminded me the logic and concept of while loops, for loops , if/else statement.
  3. Learned that dictionaries will be useful in the future to access data in keys.

Day 10 (https://repl.it/@LeeRen1/D10-calculatorPOTD):
Created a basic calculator that could do addition/subtraction/multiplication/division. The calculator can loop through so that the user could use the first answer to make another calculation or restart a brand new calculation.

  1. Learned about recursion. Which is calling the function inside the same function so that it executes on a certain condition. (line 31 & line 56)
  2. Learned about flagging with while loops. Which is to check if a certain condition is true until the condition becomes false where it will proceed to execute other codes.
  3. Reminded me of the concept of key and value of the dictionary.
  4. Learned that the input function itself could be used as an output and therefore could be used as a condition. (line 51)
  5. Learned the difference between print and return.

Day 11 (https://repl.it/@LeeRen1/D11-blackjackPOTD):
Built a Blackjack game (Player with cards closest to 21 wins/sum of scores must be above 17/if two cards=21=blackjack=wins the game immediately)

  1. Applied the knowledge used in the past 10 days.
  2. Used docstring (6 quotes/""" definition""") to define a function's purpose (when you use the function or hover over it the definition of the function will be shown)
  3. Applied flagging and recursion again.
  4. Reminded me that the functions you created should be before the line where you call it or it wont work.
  5. Learned about the sum() function and list.remove(item) function.
  6. It was hard but fun 😊

Day 12 (https://repl.it/@LeeRen1/D12-Number-Guessing-GamePOTD#main.py):
Created a number guessing game that uses most of the knowledge of past few days and add on with creating Constants. The user can choose between easy / hard to determine their turns avaialable to guess a number between 1 to 10.

  1. Learned about constants (Variables that you are not gonna change its value again like the pi value)
  2. Learned about global and local scopes(basically the location where u define your variables and whether it could be accessed within a function/while/for loop/if-else statement etc. Focuses on the indentation)
  3. Learned about the global varible_name that takes a variable into the function to allow it to be modified. But the return statement is recommended.
  4. Recapped about flagging
  5. Tried to complete the challenge before viewing the solution therefore I have two different solutions. (Top is from the video/ Bottom is mine)
  6. Used this website to create ASCII art based on the words I typed in

Day 13 (https://repl.it/@LeeRen1/D13-start#main.py):
The link above are examples of codes with bugs and their solution. Today is not a project day, but I learned 10 ways to debug🐞 codes:

  • "Describe the problem". Untangle the problem, and try to make sense of what is going on.
  • "Reproduce the bug🐞". If u encounter it once but not every time, it will be hard to fix. Therefore, try to narrow down and find out what caused the bug and reproduce it to see If the same bug occurs every time.
  • "Play computer". Try to think about how the computer will process the line of code and figure out what went wrong step by step.
  • "Fix the error". Basically, fixing an error when you come across it as it is being highlighted by the IDE.
  • "Print is your friend". Use the print statement to see after each line of code where you assume a change is made, simply print out the value of the variables to see if it is the same as what was expected.
  • "Use the debugger". Use Thonny's Debugger or Python Tutor to visualise how your code works line by line.
  • "Take a break". Simply just have a short break to have a fresh mind or perspective and get back to it again later.
  • "Ask a friend". This way you can get a new perspective without your own assumptions of what the code does and your friend can learn from your mistakes too!
  • "Run Often". Run the code often when you feel that a change has been made and has an output. This was you can debug easily rather than debugging a pile of bugs. Tackle one bug at a time if you face multiple bugs
  • "Ask StackOverflow". StackOverflow has most of the questions answered and a huge community gladly to answer your unique questions. Search for your issues first to see if there is a similar question answered previously.

Day 14 (https://repl.it/@LeeRen1/Day14-higher-lower-gamePOTD#main.py):
Built a higher-lower game that lets user guess which celebrity/ famous pages has more followers. If the user is right, b=a and b will generate a new celebrity.

  1. Reminded me about dictionaries and how to access the value with a key.
  2. Reminded me about the return statement and how it works.
  3. Reminded me about functions with inputs.
  4. Reminded me about flagging.
  5. Learned some new ways to assign a=b then b=random value each loop

Day 15 (https://repl.it/@LeeRen1/D15-coffee-machine-finalPOTD):

  1. Stopped for a few days due to competition and school assignments. Became rusty and took quite some time to figure out the code. 😫
  2. Reminded me of dictionaries/ nested dictionaries and how to access the values.
  3. Reminded me of flagging
  4. Reminded me of the use of the return statement
  5. Reminded me of the global statement
  6. Reminded me that breaking down codes into smaller chunks is easier to code.

Day 16 (https://repl.it/@LeeRen1/oop-coffee-machinePOTD#menu.py):

  1. Learned about object oriented programming.
  2. Exposed to Python Package Index(PyPI) and used a module there(PrettyTable).
  3. Learned about classes, how to access or edit attributes class.attributes and use its methods class.method() of the classes to do OOP.
  4. Learned about Tutle Graphics and the my_screen.exitonclick() to close the pop up screen when clicked.
  5. Learned a lot about how to use PyCharm and its shotcuts. I searched for some plugins to beautify the code for better visualization.

Day 17 ():

100-days-of-code-in-python's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.