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
6 changes: 6 additions & 0 deletions conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@
# - Prompts a user to enter their age.
# - Uses a conditional statement to check if the age is greater than or equal to 18.
# - Prints "You are eligible to vote" if true, otherwise "You are not eligible to vote."
age = input('Enter your age: ')

if int(age) >=18 :
print('You are eligible to vote')
else:
print('You are not eligible to vote')
9 changes: 5 additions & 4 deletions functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ def fibonacci(n):
Returns:
A list containing the Fibonacci sequence up to n terms.
"""

if n <= 1:
# Complete here
return n
else:
a, b = # complete here
a , b = 0 , 1
for _ in range(2, n + 1):
c = a + b
# Complete here
return # add the variable to be returned
a , b = b , c
return c

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