24.02.2020

in python Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies.
Ex: If the input is:
0
or less, the output is:
no change
Ex: If the input is:
45
the output is:
1 quarter
2 dimes
Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.
def exact_change(user_total)

. 4

Faq

Computers and Technology
Step-by-step answer
P Answered by PhD

amount = int(input())

#Check if input is less than 1

if amount<=0:

    print("No change")

else: #If otherwise

    #Convert amount to various coins

    dollar = int(amount/100) #Convert to dollar

    amount = amount % 100 #Get remainder after conversion

    quarter = int(amount/25) #Convert to quarters

    amount = amount % 25 #Get remainder after conversion

    dime = int(amount/10) #Convert to dimes

    amount = amount % 10 #Get remainder after conversion

    nickel = int(amount/5) #Convert to nickel

    penny = amount % 5 #Get remainder after conversion

    #Print results

    if dollar >= 1:

          if dollar == 1:

                print(str(dollar)+" Dollar")

          else:

                print(str(dollar)+" Dollars")

    if quarter >= 1:

          if quarter == 1:

                print(str(quarter)+" Quarter")

          else:

                print(str(quarter)+" Quarters")

    if dime >= 1:

          if dime == 1:

                print(str(dime)+" Dime")

          else:

                print(str(dime)+" Dimes")

    if nickel >= 1:

          if nickel == 1:

                print(str(nickel)+" Nickel")

          else:

                print(str(nickel)+" Nickels")

    if penny >= 1:

          if penny == 1:

                print(str(penny)+" Penny")

          else:

                print(str(penny)+" Pennies")

Explanation:

The first answer is almost right, but this should give you the complete answer with the proper starting point and correct capitalizations.

Computers and Technology
Step-by-step answer
P Answered by PhD

amount = int(input())

#Check if input is less than 1

if amount<=0:

    print("No change")

else: #If otherwise

    #Convert amount to various coins

    dollar = int(amount/100) #Convert to dollar

    amount = amount % 100 #Get remainder after conversion

    quarter = int(amount/25) #Convert to quarters

    amount = amount % 25 #Get remainder after conversion

    dime = int(amount/10) #Convert to dimes

    amount = amount % 10 #Get remainder after conversion

    nickel = int(amount/5) #Convert to nickel

    penny = amount % 5 #Get remainder after conversion

    #Print results

    if dollar >= 1:

          if dollar == 1:

                print(str(dollar)+" Dollar")

          else:

                print(str(dollar)+" Dollars")

    if quarter >= 1:

          if quarter == 1:

                print(str(quarter)+" Quarter")

          else:

                print(str(quarter)+" Quarters")

    if dime >= 1:

          if dime == 1:

                print(str(dime)+" Dime")

          else:

                print(str(dime)+" Dimes")

    if nickel >= 1:

          if nickel == 1:

                print(str(nickel)+" Nickel")

          else:

                print(str(nickel)+" Nickels")

    if penny >= 1:

          if penny == 1:

                print(str(penny)+" Penny")

          else:

                print(str(penny)+" Pennies")

Explanation:

The first answer is almost right, but this should give you the complete answer with the proper starting point and correct capitalizations.

Computers and Technology
Step-by-step answer
P Answered by PhD
Answer: c. internet of things.

Explanation:
The technology that combines with the 5G capabilities which was used in the monitoring of the shopping trends is the Internet of Things.
- Internet of Things (IoT) simply means when there are interrelated, and internet-connected objects which collects and transfers data without human intervention through a wireless network or makes use of sensors.
- This is being used by the retailer in the example given to monitor the shopping trends. In conclusion, the correct option is Internet of Things.
Computers and Technology
Step-by-step answer
P Answered by PhD

The solution that would help the client pool their data together is a data integration solution. This type of solution allows for the collection and consolidation of data from various sources into a single, unified database. This can be achieved through a variety of methods, including Extract, Transform, Load (ETL) processes, data warehousing, and master data management. By implementing a data integration solution, the client will be able to access and analyze their data more efficiently, leading to better insights and informed decision-making.

Computers and Technology
Step-by-step answer
P Answered by Master

The correct answer to the following question will be "Auto-encoder".

Explanation:

It is indeed a form of artificial neural net that utilizes in an unmonitored way to practice successful information coding.

The objective of such an auto-encoder seems to be to acquire a specification (encoding) for a collection of information, usually for reducing degrees of freedom, by teaching the channel to overlook the "noise" message.Learn a few things of endogenous model representation and then use it to recreate the object.
Computers and Technology
Step-by-step answer
P Answered by Master
When one encounters another vessel and assess the situation and believes that you are the stand-on vessel, You should still maintain your course unless the give-away vessel or vessel you have encountered is not taking appropriate actions, what you should do is, you should take action and move away from the vessel, do not go toward the vessel nor pass in front of it.
Computers and Technology
Step-by-step answer
P Answered by PhD

A code in C++ follows:

Explanation:

#include<iostream>

using namespace std;

int calculate_area(int width, int length)

{

int area;

area=width*length;

return area;

}

int main()

{

int a,b,ar,c,d,ar1,n;

cout<<"\nEnter length of room:";

cin>>a;

cout<<"\nEnter width of room:";

cin>>b;

ar=calculate_area(a,b);

cout<<"\nArea of room:"<<ar<<" units";

cout<<"\nEnter length of mat:";

cin>>c;

cout<<"\nEnter width of mat:";

cin>>d;

ar1=calculate_area(c,d);

n=ar/ar1;

cout<<"\nNumber of mats required are:"<<n;

return 0;

}


Codehs 7.4.6:  gymnastics mats calculate how many mats will be needed to fill a room given the dimen
Computers and Technology
Step-by-step answer
P Answered by PhD

boolean rsvp;

int selection;

String option1;

String option2;

(a) if(rsvp){

System.out.println("Attending");

} else {

System.out.println("Not attending");

}

(b) if (selection == 1){

System.out.println("Beef");

} else if (selection == 2){

System.out.println("Chicken");

} else if (selection == 3) {

System.out.println("Pasta");

} else {

System.out.println("Fish");

}

(c) switch(selection){

case 1:

if(rsvp){

option1 = "Thanks for attending. You will be served beef.";

} else{

option1 = "Sorry you can't make it";

}

break;

case 2:

if(rsvp){

option1 = "Thanks for attending. You will be served chicken.";

} else{

option1 = "Sorry you can't make it";

}

break;

case 3:

if(rsvp){

option1 = "Thanks for attending. You will be served pasta.";

} else{

option1 = "Sorry you can't make it";

}

break;

default:

if(rsvp){

option1 = "Thanks for attending. You will be served fish.";

} else{

option1 = "Sorry you can't make it";

}

break;

}

(d) if (option1 == option2){

System.out.println("True");

} else {

System.out.println("False");

}

Explanation:

This code snippet is written in Java.

a) Uses if statement to print "attending" if rsvp is true and "not attending" if rsvp is false.

b) Uses if-else statement to print the variety of food based on user selection. If selection is 1, it print beef. If selection is 2, it print chicken. If selection is 3, it prints pasta else it print fish for any other value of selection.

c) Uses switch statement to determine the value of selection and then uses inner if statement to assign "Thanks for attending. You will be served beef." if rsvp is true to option1. The value of beef changes depending on the value of selection. If rsvp is false, then "Sorry you can't make it." is assigned to option1.

d) Uses if statement to print true if option1 and option2 are equal else it print false.

Computers and Technology
Step-by-step answer
P Answered by Master

def get_word(sentence, n):

# Only proceed if n is positive

   if n > 0:

       words = sentence.split()

# Only proceed if n is not more than the number of words

       if n <= len(words):

           return words[n-1]

   return (" ")

print(get_word("This is a lesson about lists", 4)) # Should print: lesson

print(get_word("This is a lesson about lists", -4)) # Nothing

print(get_word("Now we are cooking!", 1)) # Should print: Now

print(get_word("Now we are cooking!", 5)) # Nothing

Explanation:

Added parts are highlighted.

If n is greater than 0, split the given sentence using split method and set it to the words.

If n is not more than the number of words, return the (n-1)th index of the words. Since the index starts at 0, (n-1)th index corresponds to the nth word

Try asking the Studen AI a question.

It will provide an instant answer!

FREE