#Palindrome checker
input_string = "radar"
reversed_string = input_string[::-1]
print(reversed_string, "is a palindrome")

def is_palindrome(input_string):

input_string = input_string.replace(" ", "").lower()


if input_string == input_string[::-1]:
    return True
else:
    return False
input1 = input("Do you want to check if a string is palindrome? (yes/no)")
input1 = input1.lower()
if input1 == "yes":
user_input = input("Enter a string: ")
if is_palindrome(user_input):
print("The input string is a palindrome.")
else:
print("The input string is not a palindrome.")
else:
print("Have a good rest of your day!")

#number sort
numbers = [7, 2, 9, 1, 4, 6]
numbers.sort()
print("Sorted Numbers:", numbers)

#fibanocci sequence generator
f0 = 0
f1 = 1
fiblist = [f0, f1]
r = int(input("How many items do you want in your fibonacci sequence? Enter a number 2 or greater: "))
if r < 2:
print("Please enter a number greater than or equal to 2")
else:
for i in range(r-2):
x = fiblist[-1]
y = fiblist[-2]
fiblist.append(x + y)
print(fiblist)

#real life application
class Product:
def init(self, name, price):
self.name = name
self.price = price

products = [
Product("Laptop", 900),
Product("Smartphone", 600),
Product("Tablet", 400),
Product("Headphones", 100),
Product("Keyboard", 50),
]

sorted_products = sorted(products, key=lambda product: product.price)

print("Products sorted by price:")
for product in sorted_products:
print(f"{product.name}: ${product.price}")