IT102 George Mason University Selection & Repetition Project
IT102 George Mason University Selection & Repetition Project
Instructions for the layout of your Homework Document: You are asked to draw flowcharts, create Python program files, run programs, and obtain output in the IDLE window. Photos and/or screenshots of this work must be included in your HW document.. Please ensure that everything is legible.
The final document must be in PDF format.
Show ALL of your work in order to get credit. .
Write a Python program to: ask the user to enter two integers: int1 and int2. The program uses the exponential operator to calculate and then print the result when int1 is raised to the int2 power. You also want to calculate the result when int1 is raised to the .5 power; however, you realize that it is not possible to take the square root of a negative number. If the value for int1 that is entered is a negative number, print a message to the user explaining why you cannot complete the task. Otherwise, calculate the square root and print it. Finish the program by printing the values of int1 and int2.
2. For problem # 1, when the user entered a negative number, you output a message that it was not possible to take the square root of a negative number. This time you will write a Python program that asks the user to enter a non-negative number (float). If the user does enter a negative number, you will use a while loop to continue prompting the user until you get a valid number (i.e. a number >= 0). Once the user enters a valid number, you calculate and print the square root. Test your program twice, once using a negative number and once using a non-negative number.
IT102 Chapter 5 Homework
2
input name
input debt1
input debt2
total = debt1 + debt2
total >900,000
total >450,000
output name, a danger message
output name, a reduce debt message
output name, a congrats message
3. Given this flowchart, write the program code to implement the flowchart. The algorithm: the user is asked to input the customer’s name and their debt1 amount and their debt2 amount. The total debt is calculated. If the total debt is greater than $900,000 the name and a message warning of danger is output. If not, but the total debt is greater than $450,000, the name and a message to reduce debt is output. Otherwise, the name and a message congratulating the customer on being careful is output.
Start
Stop
N
N
Y
Y
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


