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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started