import random def generate_prompt(): prompts = [ "Write a function that checks if a string is a palindrome.", "Create a class in Python that represents a basic bank account.", "Implement a sorting algorithm in your preferred language.", "Write a program to find the largest prime number less than 1000.", "Design a simple command-line calculator.", "Develop a function that calculates the factorial of a number.", "Build a script that reads a text file and counts the number of occurrences of each word.", "Create a basic to-do list application with a text-based interface.", "Write a program that converts a given temperature from Celsius to Fahrenheit.", "Implement a program to find the common elements between two lists." ] return random.choice(prompts) if __name__ == "__main__": print("Coding Prompt Generator") print("----------------------") while True: user_input = input("Press Enter to get a new coding prompt, or type 'exit' to quit: ").strip().lower() if user_input == 'exit': print("Goodbye!") break print(generate_prompt()) print()

Comments