1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
LekaFEV [45]
4 years ago
6

Write a Python program to: ask the user to enter two integers: int1 and int2. The program uses the exponential operator to calcu

late 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.
Computers and Technology
1 answer:
Triss [41]4 years ago
4 0

Answer:

int1=int(input("Enter integer :\n"))#taking input of first number.

int2=float(input("Enter the power :\n"))#taking input of the power.

if int2 == 0.5 and int1<0:#condition for negative square root.

   print("Cannot calculate the square root of negative numbers")#printing the message.

else:#else calculating the result.

   res=int1**int2

   print(res)

output:-

Enter integer :

-5

Enter the power :

0.5

Cannot calculate the square root of negative numbers

Explanation:

In the above program I have taken input of the number and the power.Since power can be decimal number taking it as float.If the number is negative and the power is 0.5 then printing the message for not calculating the value else calculating the value and storing it in the res printing the res.

You might be interested in
Write a program to compute the sum of digits in a number given by the user. You must use your own function to compute the sum of
Sergio [31]

Answer:

python program compute the sum of digits of a number using function.....hope this answer is perfect and better for urr question....thanks

4 0
3 years ago
Give four example of computer virus​
asambeis [7]

trojan virus allows some one to sneak a bunch of coruppted data or more viruses into a system. a worm is able to access some ones computer and steal information a firebug is used to crash someones computer and spyder is used to scramble some ones work and deleting it

6 0
3 years ago
Declare k, d, and s so that they can store an integer, a real number, and a small word (under 10 characters). Use these variable
Svetradugi [14.3K]

Answer:

int k;

double d;

char s[10];

cin >> k >> d >> s;

cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s;

Explanation

First Step (declare K, d, s) so they can store a integer

int k;

double d;

char s[10];

Second Step (read in an integer, a real number and a small word)

cin >> k >> d >> s;

Third Step ( print them out )

cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s;

5 0
3 years ago
A 3-Tier computing environment is constructed of ....... servers ?
Inessa [10]

Answer:

B. Tow

Explanation:

Application server and database server

6 0
3 years ago
A researcher wants to do a web-based survey of college students to collect information about their sexual behavior and drug use.
finlep [7]

The answer is already given at the end of the question; solely by the magnitude or severity of expected harm

When assessing risks of harm associated with participation in a research study, the probability of harm and the risk of the severity of harm are two distinctive elements of risk that must be considered. In probability of harm, the fact that not all possible harms are equally probable should be considered. How these two elements occur is a crucial factor in determining the level of risk of harm in a study. Given the sensitivity of the information in the case scenario above, the probability that an individual subject could be identified is low while the magnitude of the possible risk of harm is high.


5 0
4 years ago
Read 2 more answers
Other questions:
  • Melinda completed the Computer Programming Aptitude Test when she applied for a position with Beta Electronics. Six months later
    12·1 answer
  • In a database list, fields are displayed as _____. rows columns tables records
    10·1 answer
  • Adam, a college student, downloads a document containing resume templates from the Internet. When he opens the document
    13·1 answer
  • "what type of index has an index key value that points to a data row, which contains the key value? "
    9·1 answer
  • do you think that some people have difficulty talking to others face to face because of how prevalent texting is today
    15·2 answers
  • A __________ note is a private note that you leave for yourself or for other people who might use the presentation file
    9·1 answer
  • QUESTION 4 PRACTICAL EXERSIZE
    7·1 answer
  • 1.
    15·1 answer
  • Help fast fast anyone
    10·1 answer
  • If you delete search results, you will a. clear the history on the computer. b. delete files from our computer. c. modify the re
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!