Week 2 - BALT 4363 - Python Data Manipulation
In data science, visualizations are seen as one of the most important things to know how to do. This allows for easy ways to analyze data, recognize potential trends, predict where trends are going, etc. While this is very easy to do with data sets that are clean, set up nicely and organized, it can sometimes be very tricky if you have a data set that is not organized in a way that you want it.
This is where data manipulation comes in. Using Python data manipulation, you can organize data how you want to read it. Here are some examples of this manipulation:
For and While Loops
Loops allow you to repeat code. FOR loops are used fore when you want to repeat the code a specific amount of time, and While loops are for when you want to execute code as long as a condition runs as true.
Conditional Statements
Conditional statements are a very simple form of code that allow you to execute different codes depending on a condition. These are by using IF or if-else statements. A very simple way of coding this is:
if age >= 18:
print("You are an adult.")
else:
print("You are not an adult.")
Using the Manipulations
In this weeks chapter, we were given an example of how to use everything we learned to create a guessing game. I went to google collab to create this example, it looks as follows:
As you can see, when i entered the word "class", it ran as incorrect, and told me the amount of attempts I had left, as I set the attempts allowed as 5. Eventually, I entered the correct word, and it ran the code for that response instead.


Comments
Post a Comment