CPSC 230 Programming Assignment 3: While Loops solution




5/5 - (7 votes)

The Assignment
Now that we are all familiar with the while loops, let’s get some practice before we move
on. Sum.py and Con_Sum.py are required, Perfect_Square.py is additional practice but not
Sum.py: Write a python program that prompts the user for the how many numbers he/she
would like to sum and then asks the user for each number and displays the sum.
Con_Sum.py: Write a program that prompts for an integer—let’s call it x—and then finds
the sum of x consecutive integers starting at 1. That is, if x = 5, you will find the sum of 1 + 2
+ 3 + 4 + 5 = 15.
Perfect_Square.py: Write a short program prompts the user for a number, print out
whether the number is a perfect square, and prompts the user for another number if the
number was not a perfect square.
A perfect square is a number that has a whole number square root. For example, 25 is
a perfect square, because 5, is a whole number.
Due Date
This assignment is due at 11:59pm on 2-28-2020. Submit via Blackboard; create a zip file
with all your files in it. It should be labeled firstinitiallastname_Assignment3. Please make
sure to include all the required files (README, source files).
Assignments will be graded on correctness, adherence to style, and the inclusion of
meaningful comments.