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
15 changes: 15 additions & 0 deletions .replit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
modules = ["python-3.10:v18-20230807-322e88b"]
run = "python3 conditions.py"

[nix]
channel = "stable-23_05"

[unitTest]
language = "python3"

[gitHubImport]
requiredFiles = [".replit", "replit.nix"]

[deployment]
run = ["sh", "-c", "python3 conditions.py"]
deploymentTarget = "cloudrun"
13 changes: 10 additions & 3 deletions conditions.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Python Conditional Statements
# Python Conditional Statements
#example is https://plpacademy.powerlearnproject.org/course-module/62fbec9d28ac4762bc524f92/week/62fe1efd28ac4762bc524f9c/lesson/62fe1fbd28ac4762bc524f9f



# Create a Python program that:


# - 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."
def main():
age = int(input("Enter your age: "))
if age >= 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote.")

if __name__ == "__main__":
main()
12 changes: 8 additions & 4 deletions functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ def fibonacci(n):
"""
if n <= 1:
# Complete here
return n
else:
a, b = # complete here
a, b = 0, 1 # complete here
fibonacci_sequence = [a, b]
for _ in range(2, n + 1):
c = a + b
a = b
b = c
fibonacci_sequence.append(c)
# Complete here
return # add the variable to be returned
return fibonacci_sequence # add the variable to be returned


# Get the number of terms from the user
num_terms = int(input("Enter the number of terms: "))
Expand All @@ -32,10 +38,8 @@ def fibonacci(n):
# Print the Fibonacci sequence
print(fibonacci_sequence)


# Your program should:

# Ask the user to input the value of n.
# Create a function that takes n as a parameter and returns a list containing the first n terms of the Fibonacci sequence.
# Print the generated Fibonacci sequence.