Read the following code used to calculate the percentage of calories from fat in an item:


calories = input("How many calories are in the item? ")

caloriesFat = input("How many calories are from fat? ")

percentFat = caloriesFat / calories


There is an error in the code. What type of function needs to be used?


float() [I think it is this one. Is it right?]

int()

print() [NOT this one!]

str()

Answers

Answer 1

Explanation:

Problem is to cast your input values either in int() or float() this this up to you in which format you want your output,

Example2:

calories = int(input("How many calories are in the item? "))


caloriesFat = int(input("How many calories are from fat? "))


percentFat = int(caloriesFat / calories)

Now output on the screen:

print(percentFat)


Example2:

calories = float(input("How many calories are in the item? "))


caloriesFat = float(input("How many calories are from fat? "))


percentFat = float(caloriesFat / calories)

Now output on the screen:

print(percentFat)

I hope you got the idea Thanks

Answer 2

Answer:

The answer is int ()

Explanation:

Process of elimination. Only int and float are used for calculation (division obvs falls under that). Disregard the other two options. Float is for numerical values with a decimal. Calories are never shown with decimal points. So, it's int()


Related Questions

Discuss three ways you could (or currently do)use the excel software in your personal life.Provide examples of the why excel is an effective choice over other programs or apps

Answers

Uses of excels

1.    Personal fitness log: log the things you eat along with its calories and record it every day. Make a pivot of the data and see how much you have consumed. Along with this, add sleep duration, and measure the number of hours that you have slept each day during the month.

2.     Budget Planner: Make a monthly budget and maintain a log of things you buy in order to keep a track of your budget. This will help to keep a track and you will be more or less in the limits of the budget allocated during the start of the month.

3.    Headache Log: If you experience frequent headaches, then log that and when there is enough data a comparison can be done.

You can make charts and other graphical representations of the data to compare and contrast your trends and can make an efficient analysis. All these features which are present in excel are not available in other applications all at one time.

The irs offers free tax filling software named

Answers

The software is called free file

software is called free file is your correct amswer

What are effective ways to get ready for a test

Answers

make a study guide and study it for ten minutes every night before bed
Read over things you have learned in the Unit, study what you have learned. If there is a study guide provided I would recommend filling it out. Before the test ask any questions you may have to the teacher. Get a good night of sleep so that you are ready the next day to take the test! (:


Vitamins and minerals dissolve easily in water.True or false?

Answers

true vitamins and minerals dissolves in water

Answer:

true

Vitamins and minerals dissolve easily in water.

Other Questions
help me with this equations please increase or decrease 32 pages to 28 Pages round to the nearest tenth of a percent what are likely repercussions to your organisation if you were to sell contaminated food or beverages to your customer ? Reducing waste and recycling things are ways to conserve energy. True false Salmon often jump waterfalls to reach theirbreeding grounds.Starting 3.16 m from a waterfall 0.379 min height, at what minimum speed must asalmon jumping at an angle of 37.6leave thewater to continue upstream? The accelerationdue to gravity is 9.81 m/s2.Answer in units of m/s. Anna picked 6 apples. Sabrina picked 7 times as many apples. How many apples did Sabrina pick? HELP QUICK WILL CHOOSE BRAINLIEST How does nature's environment help ones path to self discovery.(Give 2 examples) Most bills can originate in either the House of Representatives or the Senate; however, __________ bills dealing with government spending must begin in the House of Representatives. find two consecutive odd integers whose product is 1443 Suppose you have 100kg of fresh strawberries. What would be the approximate mass of the strawberries after freeze-drying The figure below shows the penalty box and the goal box of a soccer field. The penalty box is the largest rectangle In stars that are near death, What can no longer contain fusion?A) Electromagnetic AttractionB)Strong ForcesC) GravityD) Planets Hypothesize what lasting effects did the removal to reservations have on the various native Americans tribes,including the efforts of the u.s government to abolish their practice and beliefs? How many 1/5 cup servings are in 3/4 of a cup of ice cream How did Theodore Roosevelt convince a government of Columbia to agree to give the US control over the land where the Panama Canal would be bulit Which career would be most suitable for someone with a strong extraversion preference in MBTI chart A) landscaperB) freelance writer C) politician D) research librarian 331 students went on a field trip .six buses were filled and 7 students traveled in cars how many students were in each bus? The human gm. Csf gene in the mouth gm dash dsf jane buried by more than 60% in their dna sequence however the scientist place to human gene into mice it functions properly what best explains why this happens Which excerpt cron part 1 of the odyssey is cited properly in MLA style Whats important legacy did the Roman Republics tribunes provide for future civilizations