Adding as many examples as I've converted so far.

This commit is contained in:
2022-12-10 17:18:44 -05:00
parent 0aa0875c42
commit 543bc78e51
21 changed files with 161 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
Build a program that requests the user's age, and return one of the following:
- <= 18 - You're a youngin'
- > 18 AND <= 35 - The early adult years
- > 35 AND <= 55 - Middle aged, time to buy a really expensive car
- > 55 AND <= 64 - Getting older...
- > 64 - Retirement! Time to live out the golden years

View File

@@ -0,0 +1,12 @@
age = int(input("Enter your age: "))
if age <= 18:
print("You're a youngin'")
elif age > 18 and age <= 35:
print("The early adult years")
elif age > 35 and age <= 55:
print("Middle aged, time to buy a really expensive car")
elif age > 55 and age <= 64:
print("Getting older...")
else:
print("Retirement! Time to live out the golden years.")

View File

@@ -0,0 +1,39 @@
intValue1 = int(input("Enter Int Value 1: "))
intValue2 = int(input("enter Int Value 2: "))
if intValue1 == intValue2:
print("Int Value 1 equals Int Value 2")
else:
print("Int Value 1 does not equal Int Value 2")
if intValue1 > intValue2:
print("Int Value 1 is greater than Int Value 2")
elif intValue1 < intValue2:
print("Int Value 1 is less than Int Value 2")
else:
print("Int Value 1 is equal to Int Value 2")
if intValue1 < 100 and intValue1 > 50:
print("Int Value 1 is greater than 50 AND less than 100")
else:
print("Int Value 1 is NOT greater than 50 AND less than 100")
if intValue2 < 25 or intValue2 > 50:
print("Int Value 2 is less than 25 OR greater than 50")
else:
print("Int Value 2 is NOT less than 25 OR greater than 50")
stringValue1 = input("Enter String Value 1: ")
stringValue2 = input("Enter String Value 2: ")
if stringValue1 == stringValue2:
print("String Value 1 is equal to String Value 2")
elif stringValue1.casefold() == stringValue2.casefold():
print("String Value 1 is equal to String Value 2 if you ignore case")
else:
print("String Value 1 does not equal String Value 2")
if intValue1 != 42:
print("Int Value 1 does not equal 42")
else:
print("Int Value 1 equals 42")