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
8 changes: 7 additions & 1 deletion conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
#example is https://plpacademy.powerlearnproject.org/course-module/62fbec9d28ac4762bc524f92/week/62fe1efd28ac4762bc524f9c/lesson/62fe1fbd28ac4762bc524f9f



age = int (input("Please Enter your age: "))
if age > 18:
print("You are eligible to vote")
elif age == 18:
print("You just turned 18, you can vote")
# Create a Python program that:
else:
print("You are not eligible")


# - Prompts a user to enter their age.
Expand Down
21 changes: 11 additions & 10 deletions functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ def fibonacci(n):
A list containing the Fibonacci sequence up to n terms.
"""
if n <= 1:
# Complete here
else:
a, b = # complete here
return n # Complete here
else:
a,b = 0,1
# complete here
for _ in range(2, n + 1):
c = a + b
# Complete here
return # add the variable to be returned
a, b = b, a + b
# Complete here
return b # add the variable to be returned

# Get the number of terms from the user
num_terms = int(input("Enter the number of terms: "))
num_terms = int(input("Enter the number of terms:"))

# Generate the Fibonacci sequence
fibonacci_sequence = []
for i in range(num_terms):
fibonacci_sequence.append(fibonacci(i))
fibonacci_sequence = [fibonacci(i) for i in range(num_terms)]



# Print the Fibonacci sequence
print(fibonacci_sequence)
Expand Down