Task 1: Palindrome Checker
Objective: Write a program that checks if a given word or phrase is a palindrome (reads the
same forwards and backwards, ignoring case and spaces). Prompt the user for input and display
whether it is or isn't.
Requirements:
Use a programming language of your choice (e.g., Python, JavaScript, or Java).
Remove spaces and convert to lowercase for comparison.
Use string manipulation to reverse the input and compare.
word = input("Enter a word: ")
start = 0
end = len(word) - 1
while word[start] == word[end] and start != end:
start += 1
end -= 1
if start == end:
print(word, "is a palindrome.")
else:
print(word, "is not a palindrome.")
Task 2: Simple Calculator
Objective: Create a basic calculator that performs addition, subtraction, multiplication, and
division on two numbers entered by the user. Prompt for the operation and numbers, then
display the result.
Requirements:
Use a programming language of your choice (e.g., Python, JavaScript, or Java).
Handle the four basic operations using conditionals.
Include error handling for division by zero and invalid operations.
# Basic Calculator
# Get user input
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
operation = input("Enter operation (+, -, *, /): ")
# Perform calculation
if operation == "+":
result = num1 + num2
elif operation == "-":
result = num1 - num2
elif operation == "*":
result = num1 * num2
elif operation == "/":
if num2 != 0:
result = num1 / num2
else:
result = "Error: Division by zero is not allowed."
else:
result = "Error: Invalid operation."
# Display result
print("Result:", result)
Task 3: To-Do List Manager
Objective: Build a simple command-line to-do list where users can add tasks, view the list, and
mark tasks as completed. Use a loop to keep the program running until the user chooses to exit.
Requirements:
Use a programming language of your choice (e.g., Python, JavaScript, or Java).
Store tasks in a list or array.
Provide a menu with options: add task, view tasks, mark as done, exit.
When marking as done, remove the task from the list.
# Simple Command-Line To-Do List
tasks = []
while True:
print("\n==== TO-DO LIST MENU ====")
print("1. Add Task")
print("2. View Tasks")
print("3. Mark Task as Completed")
print("4. Exit")
choice = input("Enter your choice (1-4): ")
if choice == "1":
task = input("Enter the task: ")
[Link]({"task": task, "completed": False})
print("Task added successfully!")
elif choice == "2":
if not tasks:
print("Your to-do list is empty.")
else:
print("\nYour Tasks:")
for index, task in enumerate(tasks):
status = "✓" if task["completed"] else "✗"
print(f"{index + 1}. [{status}] {task['task']}")
elif choice == "3":
if not tasks:
print("No tasks to mark as completed.")
else:
for index, task in enumerate(tasks):
status = "✓" if task["completed"] else "✗"
print(f"{index + 1}. [{status}] {task['task']}")
try:
task_number = int(input("Enter task number to mark as completed: "))
if 1 <= task_number <= len(tasks):
tasks[task_number - 1]["completed"] = True
print("Task marked as completed!")
else:
print("Invalid task number.")
except ValueError:
print("Please enter a valid number.")
elif choice == "4":
print("Exiting To-Do List. Goodbye!")
break
else:
print("Invalid choice. Please select between 1 and 4.")