Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/ElHT0Kw2)
## Assignments

1. Conditional Tests: Write a series of conditional tests. Print a statement
Expand Down
69 changes: 69 additions & 0 deletions assignment5/task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
laptop = "lenovo"
print("Is the laptop == 'lenovo'? I predict True")
print(laptop == "lenovo")
print ("\nIs the laptop == 'mac'? I predict False")
print(laptop == "mac")
print("-" * 10)

tshirt = "red"
print("Is the tshirt == 'red'? I predict True.")
print(tshirt == "red")
print("\nIs the tshirt == 'blue'? I predict False.")
print(tshirt == "blue")
print("-" * 10)

phone = "iphone"
print("Is phone == 'iphone'? I predict True.")
print(phone == "iphone")
print("\nIs phone == 'android'? I predict False.")
print(phone == "android")
print("-" * 10)

age = 23
print("Is age == 23? I predict True.")
print(age == 23)
print("\nIs age == 18 ? I predict False.")
print(age == 18)
print("-" * 10)

exam = "tomorrow"
print("Is exam == 'tomorrow'? I predict True.")
print(exam == "tomorrow")
print("\nIs exam == 'Monday'? I predict False.")
print(exam == "Monday")
print("-" * 10)

name = "Leo"
print("Is name == 'Leo'? I predict False")
print (name == "Leo")
print("\nIs name == 'Nick'? I predict True")
print(name == "Nick")
print("-" * 10)

temp = 28
print("Is temp == 28? I predict False.")
print(temp == 28)
print("\nIs temp == 31? I predict True.")
print(temp == 31)
print("-" * 10)

fav_sub = "math"
print("Is fav_sub == 'math'? I predict False")
print (fav_sub == "math")
print("\nIs fav_sub == 'history'? I predict True")
print(fav_sub == "history")
print("-" * 10)


hair = "black"
print("Is hair == 'black'? I predict False")
print (hair == "black")
print("\nIs hair == 'blonde'? I predict True")
print(hair == "blonde")
print("-" * 10)

fav_series = "squid game"
print("Is fav_series == 'squid game'? I predict False")
print( fav_series == "squid game")
print("\nIs fav_series == 'vikings'? I predict True")
print(fav_series == "vikings")
10 changes: 10 additions & 0 deletions assignment5/task10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
current_users = ["Nick", "Nia", "Louie", "Emily", "Kim"]
new_users = ["Tim", "Louie", "Jenna", "George", "Kim"]

for user in new_users:
if user == user in current_users:
print("This username is taken! enter a new usename:")
else:
print("This usename is available")


10 changes: 10 additions & 0 deletions assignment5/task11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for number in numbers:
if number == 1:
print("1st")
elif number == 2:
print("2nd")
elif number == 3:
print("3rd")
else:
print(f"{number}th")
24 changes: 24 additions & 0 deletions assignment5/task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
city = "Berlin"
print("Is city == 'Berlin'? I predict True.")
print(city == "Berlin")
print("\nIs the city == 'Paris'? I predict False.")
print(city == "Paris")
print("-" * 11)
print("Is city.lower() == 'berlin'? I predict True.")
print(city.lower() == "berlin")
print("Is city.lower() == 'BERLIN'? I predict False.")
print(city.lower() == "BERLIN")
print("-" * 11)

age = 12
print ("Is age == 12 and age > 5? I predict True.")
print (age == 12)
print ("\nIs age == 11 and age > 15")
print(age == 11)
print("-" * 11)

cities = ["Berlin", "Paris", "London", "Rome"]
print("Is 'Rome' in cities? I predict True")
print("Rome" in cities)
print("Is 'Tbilisi' in cities? I predict False")
print("Tbilisi" in cities)
8 changes: 8 additions & 0 deletions assignment5/task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
alien_color = "green"
if alien_color == "green":
print("You just earned 5 point!")


alien_color = "red"
if alien_color == "green":
print("You just earned 5 point!")
11 changes: 11 additions & 0 deletions assignment5/task4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
alien_color = "red"
if alien_color == "green":
print("You just earned 5 points!")
else:
print("You just earned 10 point!")

alien_color = "green"
if alien_color == "green":
print("You just earned 5 points!")
else:
print("You just earned 10 point!")
24 changes: 24 additions & 0 deletions assignment5/task5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
alien_color = "green"
if alien_color == "green":
print("You just earned 5 points!")
elif alien_color == "yellow":
print("You just earned 10 points!")
else:
print("You just earned 15 points!")


alien_color = "yellow"
if alien_color == "green":
print("You just earned 5 points!")
elif alien_color == "yellow":
print("You just earned 10 points!")
else:
print("You just earned 15 points!")

alien_color = "red"
if alien_color == "green":
print("You just earned 5 points!")
elif alien_color == "yellow":
print("You just earned 10 points!")
else:
print("You just earned 15 points!")
14 changes: 14 additions & 0 deletions assignment5/task6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
age = 14
if age == 2:
print("You are a baby")
elif age == 2 or age < 4:
print("You are a toddler")
elif age == 4 or age < 13:
print("You are a kid")
elif age == 13 or age < 20:
print("You are a teenager")
elif age == 20 or age < 65:
print("You are an adult")
else:
print("You are an elder")

12 changes: 12 additions & 0 deletions assignment5/task7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fav_fruits = ["mango", "strawberry", "watermelon"]
for fruit in fav_fruits:
if fruit == "strawberry":
print("You really like strawberries")
if fruit == "mango":
print("You really like mangos")
if fruit == "apple":
print("You really like apples")
if fruit == "avacado":
print("You really like avacados")
if fruit == "watermelon":
print("You really like watemelon")
6 changes: 6 additions & 0 deletions assignment5/task8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
usernames = ["Leonardo", "Jason", "Marry", "Admin", "Tim", "Jasmine", "Jenny"]
for username in usernames:
if username == "Admin":
print("Hello admin, would you like to see a status report?")
else:
print(f"Hello {username}, thank you for logging in again.")
8 changes: 8 additions & 0 deletions assignment5/task9.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
users = []
for user in users:
if user == "Admin":
print("Hello admin, would you like to see a status report?")
else:
print(f"Hello {user}, thank you for logging in again.")
if users == []:
print("We need to find more users!")