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
File renamed without changes.
13 changes: 13 additions & 0 deletions python/fizzbuzz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def fizzbuzz(n):
for num in range(1, n+1):
if num % 15 == 0:
print("FizzBuzz")
elif num % 3 == 0:
print("Fizz")
elif num % 5 == 0:
print("Buzz")
else:
print(num)

n = int(input("Enter a number: "))
fizzbuzz(n)
38 changes: 38 additions & 0 deletions python/to_do.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
tasks = []

def show_tasks():
if tasks:
print("Your tasks:")
for i, task in enumerate(tasks, start=1):
print(f"{i}. {task}")
else:
print("No tasks available.")

def add_task():
task = input("Enter a task: ")
tasks.append(task)
print(f"Task '{task}' added.")

def remove_task():
show_tasks()
try:
task_num = int(input("Enter task number to remove: ")) - 1
removed_task = tasks.pop(task_num)
print(f"Task '{removed_task}' removed.")
except (IndexError, ValueError):
print("Invalid task number.")

while True:
print("\nOptions: 1. Show tasks 2. Add task 3. Remove task 4. Quit")
choice = input("Choose an option: ")

if choice == "1":
show_tasks()
elif choice == "2":
add_task()
elif choice == "3":
remove_task()
elif choice == "4":
break
else:
print("Invalid option.")