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
jeka94
3 years ago
9

Write a function reverse() that accepts a nonnegative integer argument n and returns the integer that has the reverse decimal re

presentation. For example, the reverse of 12 is 21, and the reverse of both 21 and 210 is 12. Your function should also be placed in decimal.py

Computers and Technology
1 answer:
Anna35 [415]3 years ago
3 0

Answer:

the code is attached.

Explanation:

  1. First check the parameter and if it is negative, print "please enter a nonnegative integer"
  2. then using str(), convert the parameter into string
  3. using slice operation [::-1] reverse the string
  4. return it as an integer using int()

You might be interested in
Edward is a composer and needs to listen to the most accurate music files to create his compositions. What audio file type shoul
svetoff [14.1K]

Answer:

MP3

Explanation:

From the question we are informed about Edward who is a composer and needs to listen to the most accurate music files to create his compositions. In this case, the audio file type he should use to record his music is MP3 format. MP3 format Is an audio format which is a coding use in digital audio with high quality that can be used to store songs on the computer without taking much space, but with good quality. MP3 offer to listen to his/her music clearly.

4 0
3 years ago
Create a program that calculates three options for an appropriate tip to leave after a meal at a restaurant.
max2010maxim [7]

Complete Question:

Python Programming: Create a program that calculates three options for an appropriate tip to leave after a meal at a restaurant and repeats if the user enters "y" or "Y" to continue.

Print the name of the application "Tip Calculator"

- Get input from the user for "Cost of meal: "

- Calculate and display the "Tip Amount" and "Total Amount" at a tip_percent of 15%, 20%, and 25%.

- Use a FOR loop to iterate through the tip_percent

- The formula for calculating the tip amount is: tip = cost of meal * (tip percent / 100)

- The program should accept decimal entries like 52.31. Assume the user will enter valid data.

- The program should round the results to a maximum of two decimal places . At the "Continue? (y/n)" prompt, the program should continue only if the user enters “y” or “Y” to continue.

- Print "Bye!" or a salutation at the end of the program

Answer:

Answered in Python

print("Tip Calculator")

tryagain = "y"

while tryagain == "y" or tryagain == "Y":

    amount = float(input("Cost of Meal: "))

    for tip_percent in range(15,26,5):

         print(str(tip_percent)+"%")

         print("Tip Amount: "+str(round(tip_percent * amount/100,2)))

         print("Total Amount: "+str(round(amount + (tip_percent * amount/100),2)))

    tryagain = input("Continue?y/n: ")

print("Bye!")

Explanation:

This prints the name of the calculator

print("Tip Calculator")

This initializes tryagain to yes

tryagain = "y"

While tryagain is yes, the following loop is repeated

while tryagain == "y" or tryagain == "Y":

This prompts user for amount of meal

    amount = float(input("Cost of Meal: "))

This gets the tip_percent which is 15%, 20% and 25% respectively

    for tip_percent in range(15,26,5):

This prints the tip_percent

         print(str(tip_percent)+"%")

This calculates and prints the tip amount rounded to 2 decimal places

         print("Tip Amount: "+str(round(tip_percent * amount/100,2)))

This calculates and prints the total amount rounded to 2 decimal places

         print("Total Amount: "+str(round(amount + (tip_percent * amount/100),2)))

This prompts user to continue or not

    tryagain = input("Continue?y/n: ")

The program ends here

print("Bye!")

7 0
3 years ago
IDPSs can also help the organization protect its assets when its networks and systems are still exposed to ____________________
miss Akunina [59]

Answer:

The answer is "Known"

Explanation:

The network security tool also referred to as the IDPSs or Network Prevention Solution (NDPS), all organizations typically use IDPs to assess security concerns, detect security threats.  

  • It avoid breaches of security protocols by individuals, and it may also assist the company in protecting its assets.  
  • When its networks and systems either face security flaws or unable to respond to an evolving environment of risks, and other choices were incorrect because it can't be defined in the question.
3 0
3 years ago
Write a calculator program that keeps track of a subtotal like real calculators do. Start by asking the user for an initial numb
Taya2010 [7]

Answer:

num1 = float(input("Enter the first number: "))

while True:

   print("Add, Subtract, Multiply, Divide, or Quit ?")

   choice = input("Your choice is: ")

   if choice == "Quit":

       break

   num2 = float(input("Enter the second number: "))

   if choice == "Add":

       num1 += + num2

       print("The subtotal is: " + str(num1))

   elif choice == "Subtract":

       num1 -= num2

       print("The subtotal is: " + str(num1))

   elif choice == "Multiply":

       num1 *= num2

       print("The subtotal is: " + str(num1))

   elif choice == "Divide":

       num1 /= num2

       print("The subtotal is: " + str(num1))

print("The final result is: " + str(num1))

Explanation:

Ask the user for the first number

Create a while loop that iterates until specified condition occurs inside the loop

Ask the user for the operation or quitting

If the user chooses quitting, stop the loop. Otherwise, get the second number, perform the operation and print the subtotal

When the loop is done, the user enters Quit, print the final value result

8 0
3 years ago
Describe the Sign in process of an Email account.​
Inga [223]
User inputs email. User inputs password , if password and username match user allowed through.If not password or email address is incorrect notification is shown - and there also may be a limit on the amount of attempts you have to get it right.
8 0
3 years ago
Other questions:
  • What are some of the challenges that could arise from setting up a file management system on a computer?
    8·1 answer
  • Monetary Policy can be either Expansionary or Contractionary. Which of the following actions classify as Expansionary Monetary P
    7·2 answers
  • Consider the following arrays. 1 4 21 2 4 100 B # 111(A) L3π 42 Write MATLAB expressions to do the tollowing a. Select just the
    13·1 answer
  • How dependent are we on technology? ​
    15·2 answers
  • What are the coordinates of the origin point? (Select the best answer.)
    10·1 answer
  • A large electronic game manufacturer decides to establish a customer service center in Lahore, Pakistan. This is an example of _
    10·1 answer
  • How do you give brainlest things out?
    14·2 answers
  • Away message:
    14·2 answers
  • Body LanguageWhat are the nonverbal communications mentioned in the video? And how the video explained the meaning of these?
    15·1 answer
  • A(n) _________ Web page displays customized content in response to keyboard or mouse actions or based on information supplied di
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!