# selection amp repetition

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

## WHY CHOOSE US?

### We deliver quality original papers

Our experts write quality original papers using academic databases.We dont use AI in our work. We refund your money if AI is detected

### Free revisions

We offer our clients multiple free revisions just to ensure you get what you want.

### Discounted prices

All our prices are discounted which makes it affordable to you. Use code FIRST15 to get your discount

### 100% originality

We deliver papers that are written from scratch to deliver 100% originality. Our papers are free from plagiarism and NO similarity.We have ZERO TOLERANCE TO USE OF AI

### On-time delivery

We will deliver your paper on time even on short notice or  short deadline, overnight essay or even an urgent essay