Home | TPT | Create Task | Tech Talks | MCQ Test Corrections | Final Review |
GitHub Acitivites
Replit Runtime
Week
Week + Link |
---|
Week 2 |
Week 1 |
Week 0 |
Week 4
Key Takeaways:
- I learned how to add login required to specific pages on a website
- I practiced adding a new field for the sign up screen
@app_crud.route('/logout/', methods=["GET", "POST"])
def crud_logout():
# obtains form inputs and fulfills login requirements
logout()
return render_template("login.html")
def authorize(name, email, password, phone):
if is_user(email, password):
return False
else:
auth_user = Users(
name=name,
email=email,
password=password,
phone=phone # this should be added to authorize.html
)
# encrypt their password and add it to the auth_user object
auth_user.create()
return True
Week 2
Key Takeaways:
- I practiced writing a math function using classes
- I practiced creating a function that does the same thing, except the code is written imperatively rather than in OOP form
def __call__(self):
# return 0 for the GCD if one of the inputs is 0
if self.a==0:
return 0
# return 0 for the GCD if one of the inputs is 0
if self.b==0:
return 0
# checking if the two inputs evenly divide
if self.a % self.b ==0:
return self.b
if self.b % self.a ==0:
return self.a
# subtract smaller input from larger input. Replace larger value with difference and recursively call
if self.a > self.b:
self.a = self.a -self.b
return self()
if self.b > self.a:
self.b = self.b - self.a
return self()
def gcdImperative(a,b):
# return 0 for the GCD if one of the inputs is 0
if a==0:
return 0
# return 0 for the GCD if one of the inputs is 0
if b==0:
return 0
# checking if the two inputs evenly divide
if a % b ==0:
return b
if b % a ==0:
return a
# subtract smaller input from larger input. Replace larger value with difference and recursively call
if a > b:
return gcdImperative(a-b,b)
if b > a:
return gcdImperative(b-a,a)
Week 1
Key Takeaways:
- I practiced using lists within other lists
- I also practiced the logic for fibonaccia
InfoDb.append({
"FirstName": "Brian",
"LastName": "Tang",
"FavoriteSport": "Tennis",
"FavoriteColor": "Blue",
"FavoriteAnimal": "Dog",
"CountriesYouWantToTravelTo":["Germany", "Sweden", "United Kingdom", "Poland", "Iceland"]
def recur_fibonacci(n):
if n <= 1:
return n
else:
return recur_fibonacci(n-1) + recur_fibonacci(n-2)
def fib_tester():
try:
num = int(input("Enter a number for fibonacci: "))
if num == 0:
print("invalid")
else:
print("Fibonacci Sequence:")
for i in range(num):
print(recur_fibonacci(i))
except ValueError:
print("invalid")
Week 0
Key Takeaways:
- I learned how to implement menus and submenus
- I learned how to call functions through the use of menus
main_menu = [
["swapNumbers", swapNumbers.swapnumbers],
["matrix", matrix.keypad],
]
sub_menu = [
["Tree", tree.tree],
["Funcy", funcy.person],
]
def person_print(position):
print(ANSI_HOME_CURSOR)
print(RESET_COLOR)
sp = " " * position
print(sp + " \ O / ")
print(sp + " \|/ ")
# print(SHIP_COLOR, end="")
print(sp + " | ")
print(sp + " / \ ")
print(sp + " / \ ")
print(RESET_COLOR)