Computer Science 2026

HCC Website | Computer Science 2026

Assignment: Simple Calculator

Due 10/7 at 11:59

Write a simple calculator program that can add, subtract, multiply, and divide two numbers. Your program must meet the following specifications:

For example, if the user enters 10, 3, and +, your program should print something like:

10 + 3 = 13

Remember to convert user input to numbers before doing math. You can use float() to convert a string to a decimal number:

first_number = float( input("Enter the first number: ") )

Example Code

Here is a starting point. Fill in the TODO comments to meet the specifications above!

# Ask the user for two numbers
first_number = float( input("Enter the first number: ") )
second_number = float( input("Enter the second number: ") )

# Ask the user for an operation
operation = input("Enter an operation (+, -, *, /): ")

# Use if statements to perform the correct calculation
# TODO

# Print the result
# TODO
Additional Challenges (not required)

When you’re happy with your calculator, download the .py file and submit it on Thinkwave.