Ohients-Spring2021
CS 177-Programming with Multimedia Objects - Spring 2021 Programming Exercise 1-3
ASs
Unit programming exercises are designed to provide you with the opportunity to practice the skills discussed in the current unit. Before starting this assignment, review chapters 2 and 3 of Zelle, including writing simple Python programs and computing with numbers. Follow the instructions carefully, then copy/paste your completed Python code in the submission box to submit your answer. Write a program that displays a formatted table containing the cube root and the square of a sequence of numbers from 50 to 75. All commands should be contained within the main function.
1. Define a header using # comments including your name, the assignment name, and a description of the program's function.
#{insert your name here}
# This program displays a formatted table containing
# CS 177 - Programming Exercise 1-3
# the cube root and square of 20 integers starting with
# a value provided by the user
2. Write the pseudocode for each step of the program using # comments
3. Use print to display a description of the program and a blank line
4. Prompt the user for the starting integer value
5. Use print to display a header matching the following format:
Value Cube Rt. Squared
The Value label and bottom border should be left aligned in 6 characters
The Cube Rt. label and border should be centered in 10 characters
The Squared label and border should be right aligned in 9 characters
6. Define a for loop that repeats 20 times:
a. Calculate the cube root and square of the current value
b. Display the current value, cube root, and square using the following format:
The current value left aligned in 6 characters
The cube root centered in 10 characters with three decimal places
The square right aligned in 9 characters and a thousands separator
7. Use print to display a blank line and then the message: "Finished!"
Page 65 of 197