Skip to content

Latest commit

 

History

History
15 lines (8 loc) · 2.38 KB

JKrul-ExplorationOfVariables.md

File metadata and controls

15 lines (8 loc) · 2.38 KB

Chater One

Exploration of Variables

One of the most basic principles of coding is defining and using variables. Variables are used in basically every coding project and although I felt I developed a decent understanding of variables in makecode, I wanted to expand my knowledge of variables in Python. So I started out as basic as I possibly could and went from there in my exploration of variables.

I began my variable exploration in python by defining many variables. In my exploration, I used the example of ordering food at a restaurant. I defined a plethora of menu items and used the variables to put together the orders of two customers. In my hypothetical situation, I had two options each for a meat, a potato, and a vegetable. I gave the two options in each category different variable names and used the variable names to allow the customer to select their meal. My goal was to become comfortable defining variables in Python to eventually use them to create an order to send to the chefs.

pexels-photo-842142.jpeg

To further develop my learning and code, I explored what would happen if I added variables together in a single line of code. To do so, I took the food-related variables I created and added them together to create an order for the whole table, rather than just one customer at the table. At first, I struggled to get the correct syntax for Python to understand what task I wanted to accomplish. After a bit of persistence, I found that by using a “+” sign, I was able to have Python read of all the variables in a single order instead of two separate orders. I tried using “and” instead of a “+” sign, but Python only accomplished what I wanted when I used the “+” sign and not “and”.

To try to use variables in a different way, I switched back to makecode and scanned the variables tab to see what was offered. After doing the exercises in Python, the variables seemed much more manageable as I began messing around with the different potential sensors by defining them with new variables. Although not much different in function, practicing how to use variables with Python thoroughly helped me to feel more comfortable with both variables AND Python itself.

https://www.useloom.com/share/9002d77052544f57ab695f5d24553969