Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
03749a5
Update Module1.md
CSI-Mario-Sanchez Aug 19, 2021
3e89dc3
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Aug 23, 2021
fb7167e
CSI-Mario-Sanchez
CSI-Mario-Sanchez Aug 23, 2021
f02ae6a
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Aug 27, 2021
94317d0
CSI-Mario-Sanchez
CSI-Mario-Sanchez Aug 27, 2021
ceec477
CSI-Mario-Sanchez
CSI-Mario-Sanchez Aug 27, 2021
be2d81d
CSI-Mario-Sanchez
CSI-Mario-Sanchez Aug 30, 2021
1d00848
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Aug 31, 2021
c899dfd
CSI-Mario-Sanchez
CSI-Mario-Sanchez Aug 31, 2021
2e7b648
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Sep 7, 2021
c07e550
CSI-Mario-Sanchez
CSI-Mario-Sanchez Sep 7, 2021
6c4c42f
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Sep 15, 2021
a5920ac
CSI-Mario-Sanchez
CSI-Mario-Sanchez Sep 15, 2021
4dd22bd
CSI-Mario-Sanchez
CSI-Mario-Sanchez Sep 17, 2021
7d9115a
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Sep 23, 2021
a86cfd0
CSI-Mario-Sanchez
CSI-Mario-Sanchez Sep 23, 2021
fc0a94d
CSI-Mario-Sanchez
CSI-Mario-Sanchez Sep 23, 2021
caab3e7
CSI-Mario-Sanchez
CSI-Mario-Sanchez Sep 27, 2021
fe355d0
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Oct 1, 2021
6f9c20e
CSI-Mario-Sanchez
CSI-Mario-Sanchez Oct 1, 2021
6265be3
Merge branch 'main' of https://github.com/CSI-Mario-Sanchez/CSI-Pytho…
CSI-Mario-Sanchez Oct 1, 2021
43e00aa
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Oct 5, 2021
5d64bc7
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Oct 5, 2021
b2869aa
CSI-Mario-Sanchez
CSI-Mario-Sanchez Oct 5, 2021
1f5c078
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Oct 7, 2021
d7d122f
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Oct 12, 2021
8ea3d45
CSI-Mario-Sanchez
CSI-Mario-Sanchez Oct 12, 2021
1747057
CSI-Mario-Sanchez
CSI-Mario-Sanchez Oct 15, 2021
83385bb
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Oct 21, 2021
734c399
CSI-Mario-Sanchez
CSI-Mario-Sanchez Oct 24, 2021
2cb80fa
CSI-Mario-Sanchez
CSI-Mario-Sanchez Oct 25, 2021
ade5540
CSI-Mario-Sanchez
CSI-Mario-Sanchez Oct 29, 2021
2757c26
CSI-Mario-Sanchez
CSI-Mario-Sanchez Nov 2, 2021
a380ca0
CSI-Mario-Sanchez
CSI-Mario-Sanchez Nov 2, 2021
90e0b4f
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Nov 2, 2021
a104098
CSI-Mario-Sanchez
CSI-Mario-Sanchez Nov 2, 2021
032641d
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Nov 3, 2021
64aaa5e
Merge branch 'main' of https://github.com/CSI-Mario-Sanchez/CSI-Pytho…
CSI-Mario-Sanchez Nov 3, 2021
c838b5d
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Nov 8, 2021
d1d204e
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Nov 10, 2021
2448549
CSI-Mario-Sanchez
CSI-Mario-Sanchez Nov 10, 2021
5e56599
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Jan 14, 2022
d9549a3
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Jan 25, 2022
f9ce305
CSI-Mario-Sanchez
CSI-Mario-Sanchez Jan 25, 2022
9d557f2
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Jan 27, 2022
c432763
Merge branch 'main' of https://github.com/CSI-Mario-Sanchez/CSI-Pytho…
CSI-Mario-Sanchez Jan 27, 2022
c66faf3
CSI-Mario-Sanchez
CSI-Mario-Sanchez Jan 27, 2022
a4799f5
CSI-Mario-Sanchez
CSI-Mario-Sanchez Jan 27, 2022
3b09b33
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Feb 2, 2022
1937ec1
CSI-Mario-Sanchez
CSI-Mario-Sanchez Feb 2, 2022
45d52d5
CSI-Mario-Sanchez
CSI-Mario-Sanchez Feb 2, 2022
6d5b7e4
CSI-Mario-Sanchez
CSI-Mario-Sanchez Feb 4, 2022
5d75c0e
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Feb 10, 2022
bd4f2d4
CSI-Mario-Sanchez
CSI-Mario-Sanchez Feb 10, 2022
235999e
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Feb 14, 2022
39a1dd7
CSI-Mario-Sanchez
CSI-Mario-Sanchez Feb 14, 2022
dd51220
CSI-Mario-Sanchez
CSI-Mario-Sanchez Feb 18, 2022
0f09da3
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Feb 18, 2022
6da4ea1
CSI-Mario-Sanchez
CSI-Mario-Sanchez Feb 18, 2022
fc59ed2
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Feb 28, 2022
31a61b0
CSI-Mario-Sanchez
CSI-Mario-Sanchez Feb 28, 2022
475ffb1
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 1, 2022
d06cab4
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 1, 2022
b889175
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 1, 2022
1ce7efb
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Mar 9, 2022
b9b4fc2
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 9, 2022
0a6ffd7
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 9, 2022
2edbe52
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 9, 2022
db90e9b
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 9, 2022
933d1c3
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 9, 2022
148d5c7
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 9, 2022
7d2170e
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 10, 2022
0a4e730
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 10, 2022
871d387
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 10, 2022
baf64a3
CSI-Mario-Sanchez
CSI-Mario-Sanchez Mar 10, 2022
80960e4
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Mar 10, 2022
43b34c5
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Mar 17, 2022
ce95f81
Merge branch 'CSI-Carlos-Cobian:main' into main
CSI-Mario-Sanchez Apr 5, 2022
d2aaa69
CSI-Mario-Sanchez
CSI-Mario-Sanchez Apr 5, 2022
a483e09
CSI-Mario-Sanchez
CSI-Mario-Sanchez Apr 21, 2022
b39fc71
CSI-Mario-Sanchez
CSI-Mario-Sanchez Apr 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Projects/Bonus-ASCII-Art/Bonus-ASCII-Art.pdf
Modules/Module4/planets.py
Projects/Projectile-Motion/planets.py
Projects/Your weight in space/planets.py
Projects/Web-Servers/requests
*.pyc
8 changes: 4 additions & 4 deletions Modules/Module1/Module1.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,19 @@ You may update both simultaneously from Visual Studio by selecting.

What is the difference between Git and GitHub?

- Answer:
- Answer: GitHub is the website with repositories in them. Git is the system used to synchronize separate computers' files into one repository, such as in a GitHub repository. To be able to send information from your own personal computer into GitHub, you need to have Git on your personal computer.

What is the difference between a git commit and a git push?

- Answer:
- Answer: A git commit essentially saves the state in which the files will be sent into the remote repository. The git push is when the information is actually sent to the remote repository. Essentially, the git push is the confirmation that the information that was committed is the one that should be sent.

What is the difference between a pull, and an upstream pull?

- Answer:
- Answer: A pull is what takes the information from a remote repository into a personal local repository, such as a computer. An upstream pull is what takes the information from the main repository branch into a fork repository branch.

What part of these instructions was unclear or incomplete?

- Answer:
- Answer: n/a

Type down any class notes below this sentence:

Expand Down
Binary file added Modules/Module2/CSI-Mario-Sanchez-Module2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion Modules/Module2/HelloWorld.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from datetime import datetime
import os.path as path
from pathlib import Path

exec(open(str(path.join(Path(__file__).parents[2],"images/logo.py")),"r").read())

now = datetime.now()
current_time = now.strftime("%H:%M:%S")
Expand All @@ -8,4 +12,5 @@

print(f"Hello {name}! ")
print(f"Your Student id is: {studentId} ")
print(f"Currently, the time is: {current_time} ")
print(f"Currently, the time is: {current_time} ")

10 changes: 5 additions & 5 deletions Modules/Module2/Module2.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,23 @@ Typing `python` *(or `python3`)* into the terminal will enter the Python console
What is a benefit of using Markdown?
https://www.markdownguide.org/getting-started/

- Answer:
- Answer: Markdown is more versatile than other text formats such as Microsoft Word. It can be used for any computer text-based application, independent of the platform, works regardless of the application, making it future proof, and is supported on many different websites.

What does "cd" stand for?

- Answer:
- Answer: change directory, which is why it is the command used to move between files on a repository.

Did you get stuck at any point or become confused with your console? (yes/no) If so, what happened? How did you solve it?

- Answer:
- Answer: I had a problem when using python in the console, which I circumvented by running Python through VS Code's run button, rather than using the terminal.

Did you consider searching google for other commands to run? What did you try?

- Answer:
- Answer: I did not try any commands aside from cd or python, as they were not relevant to what I was doing. However, I was already familiar with the cd command for searching through files in the terminal from prior experience with Git Bash.

What would you like to program?

- Answer:
- Answer: I would like to write robotics-related programs, such as those that directly relate to robotic functions such as their movement or sensors, as well as any potential artificial intelligence that the robot would need for its functions, such as in reacting to stimuli that it receives through its sensors.

Type down any class notes below this sentence:

Expand Down
10 changes: 5 additions & 5 deletions Modules/Module3/Module3.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,24 @@ print(type(age))

What is the difference between "42" and 42.

- Answer:
- Answer: "42" is a string. The computer sees it as the character 4 and the character 2, in that order. If left as "42", no mathematical operations can be performed with it directly, although it can be edited in the same way a string can (ie: adding characters, removing characters, etc). 42 is an integer. Mathematical operations can be performed directly with it. It can be added to another value, another value can be added into it, etc. It cannot, however, behave as a string would, with the ability to directly edit the characters, as the characters for the integer 42 that appear on screen are simply a representation of the value of the integer, not an actual string.

Define the boolean operators: >, <, ==, >=, <=

- Answer:
- Answer: > means "is greater than". If you were to write a > b, it will return true if the value of a is greater than that of b, and will return false otherwise. < means "is less than". The opposite applies to this one. In the case of a < b, if the value of b is greater than that of a, it will return true, and will return false otherwise. == means "is equal to". In the case of a == b, if a and b both hold the same value, it will return true, and will return false otherwise. >= means "is greater than or equal to" In the case of a >= b, it will return true if a has either a value larger than b or the same as b, and will return false otherwise. <= means "is less than or equal to". In the case of a <= b, it will return true if the value of b is larger than a or is the same as a, and will return false otherwise.

How do you address an index in an list? Write a python code that assigns 34 to a new variable by accessing the value stored in:
arr = [4, 3, -1, 4, 34]

- Answer:
- Answer: The index of an array can be found by counting its place in the array and subtracting 1 (the fifth element of the array has the fourth index, the first element has the index zero, etc). To access a specific index i in array arr, you would write arr[i]. In the case of the array shown above, as 34 is stored in the fifth element, it would be assigned the index of four. So, to access it, you would write arr[4]. If you want to assign it to a new variable, say x, you would write x = arr[4].

What is the first index of a list? Why?

- Answer:
- Answer: The first index of a list is 0. This is because the computer counts in binary, beginning at 0. In the long run, this will save storage on the computer, as it will need to use less bits of memory for each array. For example, if you have an array of 2 elements, indexes 0 and 1, you can use a single bit to store the index, as you would only need to have one space in memory as true or false. If the indexes started at 1, the indexes would instead be 1 and 2. 2 is stored in binary as 10, needing two bits of memory to store. This means that it is unnecessarily wasting memory. Although it seems like a small issue at first, it scales up over time. In the early days of computing especially, as there was not much memory, this meant that vital spaces in memory could be saved.

Provide an original example of a null value. It must prove your understanding of the concept.

- Answer:
- Answer: Hypothetically, a form could ask for a person's first, middle, and last name. Not every person necessarily has a last name. This means that, although there is a string waiting to be assigned the middle name, it could never be filled, due to the fact that a person with no name could be filling the form. So this middle name string could be initialized with a null value, to show that the person has completed the form, but with the null value to show that the person simply left the space blank.

Type down any class notes below this sentence:

Expand Down
Binary file added Modules/Module4/Module4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions Modules/Module4/Module4.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,20 @@ Evaluate the following code. Is the code written correctly? What would be the co
print('This message has a syntax error!")
print(Churrigueresco)

- Answer:
- Answer: Churrigueresco is not a string and is undefined. You would need to put " or ' around it in order to make it a string, changing it to print('Churrigueresco').

Evaluate the following code. Is the code written correctly? What would be the correct code?
someNumber=360
print(' The Number is someNumber ')
Expected: The Number is 360

- Answer:
- Answer: This is not correct due to the fact that someNumber is contained within ', meaning that it will print "someNumber" rather than the value within the variable. In order to change it so that it prints the value of someNumber, you would need to cast it a string. The line would then be print('The Number is ' + str(someNumber)) so that someNumber turns into a string and concatenates with the rest of the string. You could also make it a functional print function with print(f'The Number is {someNumber}')

Define a function that takes 2 or more string parameters and prints a single line using them as part of a functional string. The function may do anything you chose but the function name and parameter names must be representative of what they are.

- Answer:
- Answer:
def printParameters(a:str, b:str):
print(f'The first parameter is {a}, and the second parameter is {b}')



Expand All @@ -160,19 +162,19 @@ Which code returns the length of the string s0:

s0 = "What is my length? Store it as a number in a variable."

- Answer:
- Answer: Use the function len(s0), and apply it to a variable such as x = len(s0)

How do you create a substring in python?
Create a substring of s1 containing only my name. Store it in a variable called ss1.
https://www.freecodecamp.org/news/how-to-substring-a-string-in-python/

s1 = "Hello Student! My name is Carlos Jose Cobián. I enjoy coding and video games!"

- Answer: ss1 =
- Answer: use ss1[first index : last index], which in this case would be s1 = s1[26:44]

Capitalize every letter of ss1 using a function. Store it in a variable called SS1.

- Answer: SS1 =
- Answer: use the capitalize() function, such that SS1 = ss1.capitalize()


This last section is not worth any points, but is worth looking into. It is good string manipulation practice and contains exercises that you may see in a pop quiz!
Expand Down
32 changes: 32 additions & 0 deletions Modules/Module4/Module4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
def greetStudent(name):
print(f"Hello, {name}!")
name = 'Mario Sanchez'
greetStudent(name)

var:str = "regular string"
myNumber:float = 3.5

myFunctionalString = f"Combine an existing {var} with a number such as: {myNumber} or execute something like {round(3.4 * 1.1)}"

print(myFunctionalString)

print(f"Or use the print directly {myNumber}")

breakfast = None
lunch = None
dinner = None
meal = ["", "", ""]

def updateMeal():
breakfast = input("What did you have for breakfast? " )
meal[0] = breakfast
lunch = input("What was your Lunch? ")
meal[1] = lunch
dinner = input("What did you eat for dinner? ")
meal[2] = dinner
print(f"Your breakfast was: {meal[0]}")
print(f"Your lunch was: {meal[1]}")
print(f"Your dinner was: {meal[2]}")

updateMeal()
input()
Binary file added Modules/Module5/CSI-Mario-Sanchez-5.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 17 additions & 3 deletions Modules/Module5/Module5.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,23 @@ print(f"Computer selected: {computerChoice}")
Give a python example for each logic operator in the module image.

- Answers:
- OR:
- AND:
- NOT:
- OR: used if the code you want to execute only needs one of several values to be true in order to execute. for instance, if you want to write code to check if it is the weekend, you would write the following:
if (day == "saturday" or day == "sunday"):
print("It is the weekend")
else:
print("It is a weekday")
- AND: used if the code you want to execute needs multiple values to be true in order to execute. for instance, if you want to check if a grade is in the range to be a B, you would write:
if (grade >= 80 and grade < 90): # in this case, a B is
# assumed to be an average
# of 80-89
print("Your grade is a B")
else:
print("Your grade is not a B")
- NOT: this operator is used if a code should execute only if a specific value is not true. For instance, to check if a number is odd, you would write
if not ( num % 2 == 0): # this is assuming the value is an int
print("The number is odd")
else:
print("The number is even")


Type down any class notes below this sentence:
Expand Down
39 changes: 39 additions & 0 deletions Modules/Module5/RockPaperScissors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import random

rps = ["rock", "paper", "scissors"] # Creates an array of RPS options
opponentThrow = random.choice(rps) # Assigns a choice of throw for the opponent randomly
print("Let's play rock paper scissos!\nChoose to throw rock, paper, or scissors!")
userThrow = input("What will you throw? ") # Takes user input
userThrow = userThrow.lower() #Turns user input to lowercase to easily compare with opponent's throw
# Ensures that the input is one of the accepted values of RPS
if not (userThrow == "rock" or userThrow == "paper" or userThrow == "scissors"):
print("Answer not recognized. Please choose between rock, paper, or scissors.")
userThrow = input("What is your choice? ")

# Checks if both the user and opponent throw are the same, bypassing the need to add this to every if value for the separate throws.
if userThrow == opponentThrow:
print(f"You both threw {userThrow}! It's a tie!")

# If value for when the user throws rock. If the opponent threw paper, the player loses. If the user does not throw paper,
# the user wins. Since the option of the same value (both rock) has already been done prior to the if statement,
# the player will only win if the enemy throws a scissors
elif userThrow == "rock":
if opponentThrow == "paper":
print(f"You threw {userThrow} and your opponent chose {opponentThrow}. The opponent's {opponentThrow} beats your {userThrow}! You lose!")
else:
print(f"You threw {userThrow} and your opponent chose {opponentThrow}. Your {userThrow} beats the opponent's {opponentThrow}! You win!")

# Same as the rock logic, but in the case of paper and the values that it loses to and beats.
elif userThrow == "paper":
if opponentThrow == "scissors":
print(f"You threw {userThrow} and your opponent chose {opponentThrow}. The opponent's {opponentThrow} beats your {userThrow}! You lose!")
else:
print(f"You threw {userThrow} and your opponent chose {opponentThrow}. Your {userThrow} beats the opponent's {opponentThrow}! You win!")

# Same as rock and paper logic, but for other values. Since only "rock", "paper", and "scissors"
# are accepted, this will only run if the player throws a scissors.
else:
if opponentThrow == "rock":
print(f"You threw {userThrow} and your opponent chose {opponentThrow}. The opponent's {opponentThrow} beats your {userThrow}! You lose!")
else:
print(f"You threw {userThrow} and your opponent chose {opponentThrow}. Your {userThrow} beats the opponent's {opponentThrow}! You win!")
16 changes: 11 additions & 5 deletions Modules/Module6/Module6.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,29 @@ myStudent = Student(**studentJson)

What does JSON Stand for?

- Answer:
- Answer: JSON is JavaScript Object Notation, which is used to convert objects into data for uses such as web servers.

Why are JSON formats important?

- Answer:
- Answer: JSON formatting essentially gives a consistent way to transfer data as a string rather than an object. By having this consistent structure for data, any programming language can deserialize a JSON into an object, meaning that JSON files are useful even when moving data between code made in different languages.

Create an example of a JSON object with at least 4 values. It may represent anything but it must be original.

- Answer:
- Answer: JSON object for a triangle:
{
"base": 3,
"height": 4,
"area": 6,
"perimeter": 12
}

What is the difference between serialization and deserialization?

- Answer:
- Answer: Serialization and deserialization are essentially inverse operations. To serialize something means to turn it into a string that holds the data from an object, while deserialization means to convert a string of data back into an object.

Research data persistance. What did you find?

- Answer:
- Answer: Data persistence is essentially the process of saving data, where the data is stored even when a procedure is no longer running. This is important due to the fact that if data is not persistent, it can be lost. Ensuring that data persists constantly can sometimes be taxing on a computer, so a balance between persistence and performance is necessary.

Type down any class notes below this sentence:

Expand Down
10 changes: 5 additions & 5 deletions Modules/Module7/Module7.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,23 @@ for student in studentsJson:

What is an Iterator?

- Answer:
- Answer: An iterator essentially repeats a set of steps as long as a certain condition, which is set by the programmer, is being met. The condition can be one that has an unknown number of repetitions, which can vary depending on the value of a variable, or they can be repeated a specified number of times that the programmer wants.

Why are iterators important im programming?

- Answer:
- Answer: Iterators have many useful applications. One of those is that it can condense code that would otherwise be much larger. For instance, instead of needing to copy and paste code 10 times, you can put it inside of a for loop that repeats 10 times. It can also be useful when a programmer wants to repeat a certain number of steps that varies depending on the input. For instance, a programmer might want to move through all of the values of an array. Since arrays vary in length, something such as a for each loop is useful so that it can always iterate as many times as necessary for each individual array, without needing to alter the code to accomodate every specific array.

What is the purpose of a for-loop.

- Answer:
- Answer: A for loop (sometimes called a for each loop in other languages) iterates over an array or list. The for each loop creates a variable in each iteration that will correspond to a specific value in the array, going in ascending order (the first iteration will have the variable equal to the first value, the second iteration to the second, so on and so forth). Using the range method makes it so that instead of moving through an array of different values, it goes through an array of numbers, which is useful for when someone needs to iterate a specific number of times but does not need to directly use a value in an array or list.

Describe how the modulus operand allows us to determine when a number is odd. Provide a mathematical example.

- Answer:
- Answer: The modulus operand determines the remainder of a mathematical operation. For instance, 1 / 3 is 0 with a remainder of 1, so 1 % 3 is 1. All even numbers divided by 2 will have a remainder of 0, while all odd numbers will have a remainder of 1, meaning that n % 2 == 0 will only trigger if n is even, while n % 2 == 1 will only trigger if n is odd.

How do you create an infinite loop in python?

- Answer:
- Answer: While loops only break if the condition set at the beginning of the loop stops being met or if a break statement is used. Due to this, if you ensure that the condition will never stop being true and that there is no statement to break the loop, a while loop can go on forever, Generally, people will use statements such as while 1 == 1, although others prefer to simply use while True. The specific value doesn't matter, as well as the condition is always true.

Type down any class notes below this sentence:

Expand Down
23 changes: 23 additions & 0 deletions Projects/ASCII_Initials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
def print_A():
print(" A \n / \ \n /___\ \n / \ \n/ \\")
def print_I():
print(" _______ \n | \n | \n | \n ___|___ ")
def print_M():
print("|\ /|\n| \ / |\n| \ / |\n| V |\n| |")
def print_O():
print(" _____ \n / \ \n | | \n | | \n \_____/ ")
def print_R():
print(" ____ \n | \ \n |___/ \n | \ \n | \ \n | \ ")
def printName():
print_M()
print()
print_A()
print()
print_R()
print()
print_I()
print()
print_O()
print()
printName()

4 changes: 4 additions & 0 deletions Projects/ASCII_Name_Print.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import sys
import ASCII_Initials

ASCII_Initials.printName()
Binary file added Projects/CSI-Mario-Sanchez-ASCII-1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading