x = input("What is your favorite color")

print("Your favorite color is " + x + ".")
notSortedList=[76, 23, 45, 12, 54, 9,2]
print("Original List:", notSortedList)
 
# sorting list using nested loops
for i in range(0, len(notSortedList)):
    for j in range(i+1, len(notSortedList)):
        if notSortedList[i] >= notSortedList[j]:
            notSortedList[i], notSortedList[j] = notSortedList[j],notSortedList[i]
 
# sorted list
print("Sorted List", notSortedList)
top5_superbowl_rings = {
    "New England Patriots": "6",
    "Pittsburgh Steelers": "6",
    "San Francisco 49ers": "5",
    "Dallas Cowboys": "5",
    "Green Bay Packers": "4"

}

print(top5_superbowl_rings)
# A simple Python program to demonstrate working of iterators using an example type
# iterates from 1 to whatever number

# A user defined type
class Test:

	def __init__(self, max):
		self.max = max

	# Creates iterator object
	# Called when iteration is initialized
	def __iter__(self):
		self.x = 1
		return self
	
	def __next__(self):

		# Store current value of x
		x = self.x

		# Stop iteration if limit is reached
		if x > self.max:
			raise StopIteration

		# otherwise increment and return old value
		self.x = x + 1;
		return x


# Prints numbers from 1 to 15
for i in Test(30):
	print(i)

pickAColor = input("Red or Blue")

if(pickAColor == "Red" or pickAColor == "red"):
    pickANumber = input("10 or 20")
    if(pickANumber == "10"):
        print("You like 10")
    elif(pickANumber == "20"):
        print("You like 20")
    else:
        print("You don't like 10 or 20")
elif(pickAColor == "Blue" or pickAColor == "blue"):
    pickANumber = input("60 or 70")
    if(pickANumber == "60"):
        print("You like 60")
    elif(pickANumber == "70"):
        print("You like 70")
    else:
        print("You don't like 60 or 70")
else:
    print("Please pick red or blue")
# Define the tax brackets and rates
tax_brackets = [(0, 10000, 0.10), (10001, 50000, 0.20), (50001, 100000, 0.30), (100001, None, 0.40)]

# Function to calculate income tax
def calculate_tax(income):
    tax = 0
    remaining_income = income

    for bracket in tax_brackets:
        min_income, max_income, rate = bracket

        if remaining_income <= 0:
            break

        if max_income is None or remaining_income <= max_income:
            taxable_income = remaining_income - min_income
        else:
            taxable_income = max_income - min_income

        if taxable_income > 0:
            tax += taxable_income * rate
            remaining_income -= taxable_income

    return tax

# Input income from the user
try:
    income = float(input("Enter your annual income: $"))
    if income < 0:
        print("Income cannot be negative.")
    else:
        tax_amount = calculate_tax(income)
        print(f"Your income tax: ${tax_amount:.2f}")
except ValueError:
    print("Invalid input. Please enter a valid income as a number.")