Question: Write a short program Open the IDLE, and using your lectures slides, starting from lecture 4, write a program that asks the user a number

Write a short program

Open the IDLE, and using your lectures slides, starting from lecture 4, write a program that asks the user a number as input (remember to use eval) and computes the square root (before you must import math and then use sqrt as math.sqrt(number)). Then, print the result of the square root.

Add the program below:

Test the program for positive, negative and zero numbers. Then, say why it does not work with negative numbers:

Reply below:

If the program uses the power operator ** instead of sqrt, it will also work with negative numbers. Try this change. And say what kind of result you got:

Reply below:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!