The remainder when 23 is divided by 3 is 2
The remainder when 25 is divided by 3 is 1
The remainder when 53 is divided by 3 is 2
69 is divisible by 3
42 is divisible by 3
90 is divisible by 3
#Homework Hack
def fibonacci(n):
if n < 0:
raise ValueError("Input must be a non-negative integer.")
elif n == 0:
return 0
elif n == 1:
return 1
else:
a, b = 0, 1
for _ in range(2, n + 1):
a, b = b, a + b
return b
def calculate_area():
shape = input("Enter the shape (circle, square, rectangle): ").lower()
if shape == "circle":
radius = float(input("Enter the radius of the circle: "))
area = 3.14159 * radius ** 2
print(f"The area of the circle is: {area}")
elif shape == "square":
side = float(input("Enter the side length of the square: "))
area = side ** 2
print(f"The area of the square is: {area}")
elif shape == "rectangle":
length = float(input("Enter the length of the rectangle: "))
width = float(input("Enter the width of the rectangle: "))
area = length * width
print(f"The area of the rectangle is: {area}")
else:
print("Invalid shape! Please enter 'circle', 'square', or 'rectangle'.")
n = int(input("Enter the term number for the Fibonacci sequence: "))
print(f"The {n}th term in the Fibonacci sequence is: {fibonacci(n)}")
calculate_area()
Enter the term number for the Fibonacci sequence: 7
The 7th term in the Fibonacci sequence is: 13
Enter the shape (circle, square, rectangle): circle
Enter the radius of the circle: 7
The area of the circle is: 153.93791