Lab 1: Math expressions and input/output | CMSC 105 Elementary Programming - Fall 2024

Lab 1: Math expressions and input/output

Part 1: The Python Prompt

If you provided a copy of the IDLE output from part 1 into a file called lab1.txt you get full credit (75 points).

Part 2: Program Assignment

''' 
Author name: <Your name here>
This program calculates the circumference of a circle 
based on the radius input by the user.
'''

# Set a variable that will hold the value of pi
PI = 3.14159

# Ask the user to enter a value for the radius
radius = eval(input("Enter a radius: "))  

# Calculate the circumference of the circle using the formula 2 * PI * radius
circumference = 2 * PI * radius

# Print the results
print("The circumference is", circumference)

Grading Rubric for the program:

Grading Points Possible
Appropriate header and comments 5
Input 5
Computation 10
Print output 5

TOTAL 25 points