In this problem, you should write one function named count_calories. This function should have one parameter, which will be a dictionary of food items. The keys will ne the name of a food item (such as 'granola' or 'steak'), and the value associated with each food will be the integer calorie amount for that food. The function should iterate through all of the foods and sum up the total calories, and then return that number. For example:
count_calories({'chocolate':200, 'milk':120, 'steak':250}) should return 570.
count_calories({'carrot':5, 'apple':50}) should return 55.
Make sure to include only the one function in your file.

Answers

Answer 1

Answer:

The function is as follows:

def count_calories(dictt):

   total = 0

   for keys, values in dictt.items():

       total+=values

   

   return total

Explanation:

This defines the function

def count_calories(dictt):

This initializes total to 0

   total = 0

This iterates through the dictionary

   for keys, values in dictt.items():

This adds the dictionary

       total+=values

This returns the calculated total    

   return total


Related Questions

Write a function named word_beginnings that has two parameters line a string ch a character Return a count of words in line that start with ch. For the purposes of this exercise a word is preceeded by a space. Hint: add a space to the beginning of line For example if line is 'row row row your raft' and ch is 'r' the value 4 will be returned. Note: You can use lists in this question but try to solve it without lists.

Answers

Answer:

The function in Python is as follows:

def word_beginnings(line, ch):

   count = 0

   lines =line.split(" ")

   for word in lines:

       if word[0] == ch:

           count+=1

   return count

Explanation:

This defines the function

def word_beginnings(line, ch):

This initializes count to 0

   count = 0

This splits line into several words

   lines =line.split(" ")

This iterates through each word

   for word in lines:

This checks if the first letter of each word is ch

       if word[0] == ch:

If yes, increment count by 1

           count+=1

Return count

   return count

Read the scenario and then answer the question using only the information provided.

A report titled “Dog Breeds” contains information about four breeds of dogs. Information about each breed is contained in a separate table. Which best describes how the report is organized?

The report is grouped and sorted.

The report is sorted only.

The report is grouped only.

Answers

Answer:

The report is grouped and sorted.

Answer:

C. the report is grouped only

Explanation:

An electronics technician who enjoys working "at the bench" would most likely want to work

Answers

Answer: for a manufacturer

Explanation:

The options include:

A. for a manufacturer.

B. as a microwave technician.

C. as a central office technician.

D. for a TV or radio station.

An electronics technician who enjoys working "at the bench" would most likely want to work with a manufacturer.

In this case, if the person wants to work at the bench since he or she enjoys it, then the person should work for a manufacturer.

Best monitor cofficiant modern warfare

Answers

Answer: Monitor coefficient only determines your vertical sens with respect to your horizontal. It should be your horizontal pixels divided by your vertical. E.g. for a 1920 x 1080 monitor it should be 1.33. For a 2560 x 1440 it should be 1.78.

Explanation:

Answer:

1920 x 1080 monitor or 2560 x 1440

if your looking for a smooth gaming experience also depends on the graphic card and processer you use

Explanation:

You need to write a menu driven program. The program allows a user to enter five numbers and then asks the user to select a choice from a menu. The menu should offer the following four options – 1. Display the smallest number entered 2. Display the largest number entered 3. Display the sum of the five numbers entered 4. Display the average of the five numbers entered

Answers

Answer:

In Python:

nums = []

for i in range(5):

   num = int(input("Num: "))

   nums.append(num)

print("1 - Smallest")

print("2 - Largest")

print("3 - Sum")

print("4 - Average")

menu = int(input("Select menu: "))

if menu == 1:

   print("Smallest: ",min(nums))

elif menu == 2:

   print("Largest: ",max(nums))

elif menu == 3:

   isum = 0

   for i in range(5):

       isum+=nums[i]

   print("Sum: ",isum)

elif menu == 4:

   isum = 0

   for i in range(5):

       isum+=nums[i]

   print("Average: ",isum/5)

else:

   print("Invalid Menu Selected")

Explanation:

This program uses a list to get inputs for the 5 numbers

Here, the list is initialized

nums = []

This iterates from 1 to 5

for i in range(5):

This gets input for the 5 numbers

   num = int(input("Num: "))

This appends each number to the list

   nums.append(num)

The next 4 lines represents the menu

print("1 - Smallest")

print("2 - Largest")

print("3 - Sum")

print("4 - Average")

This prompts the user for menu

menu = int(input("Select menu: "))

If menu is 1, print the smallest

if menu == 1:

   print("Smallest: ",min(nums))

If menu is 2, print the largest

elif menu == 2:

   print("Largest: ",max(nums))

If menu is 3, calculate and print the sum of all inputs

elif menu == 3:

   isum = 0

   for i in range(5):

       isum+=nums[i]

   print("Sum: ",isum)

If menu is 4, calculate and print the average of all inputs

elif menu == 4:

   isum = 0

   for i in range(5):

       isum+=nums[i]

   print("Average: ",isum/5)

If menu is not 1 to 4, then print invalid menu

else:

   print("Invalid Menu Selected")

Read the scenario and then answer the question using only the information provided.

A report titled “Students in Freshman Chemistry” contains the names of college students enrolled in a freshman chemistry course. Names are organized in ascending alphabetical order. Which best describes how the report is organized?

The report is grouped and sorted.

The report is sorted only.

The report is grouped only.

Answers

Answer:

It’s b the report is sorted only

Explanation:

Compile and Execute a Program
1. Compile Pay.java using the JDK or a Java IDE as directed by your instructor.
2. You should not receive any error messages.
3. When this program is executed, it will ask the user for input. You should calculate several different cases by hand. Since there is a critical point at which the calculation changes, you should test three different cases: the critical point, a number above the critical point, and a number below the critical point. You want to calculate by hand so that you can check the logic of the program. Fill in the chart below with your test cases and the result you get when calculating by hand.
4. Execute the program using your first set of data.
Record your result. You will need to execute the program three times to test all your data. Note: you do not need to compile again. Once the program compiles correctly once, it can be executed many times. You only need to compile again if you make changes to the code. Hours Rate Pay (hand calculated) Pay (program result) LLLLLLLLLL import java.util.Scanner; // Needed for the Scanner class This program calculates the user's gross pay. public class Pay public static void main(String[] args) // Create a Scanner object to read from the keyboard. Scanner keyboard = new Scanner(System.in); // Identifier declarations double hours; // Number of hours worked double rate; // Hourly pay rate double pay; // Gross pay // Display prompts and get input. System.out.print("How many hours did you work? "); hours = keyboard.nextDouble(); System.out.print("How much are you paid per hour? "); rate - keyboard.nextDouble(); // Perform the calculations. if (hours <- 40) pay - hours * rate; else pay - (hours - 40) - (1.5 * rate) + 40 - rate; // Display results. System.out.println("You earned $" + pay);

Answers

Answer:

import java.util.Scanner;

// Needed for the Scanner class This program calculates the user's gross pay.

public class Pay {

public static void main(String[] args) {

// Create a Scanner object to read from the keyboard.

Scanner keyboard = new Scanner(System.in);

// Identifier declarations

double hours;

// Number of hours worked

double rate;

// Hourly pay rate

double pay;

// Gross pay

// Display prompts and get input.

System.out.print("How many hours did you work? ");

hours = keyboard.nextDouble();

System.out.print("How much are you paid per hour? ");

rate = keyboard.nextDouble();

// Perform the calculations.

if (hours <= 40) {

pay = hours * rate;

}

else

{

pay = (hours - 40) - (1.5 * rate) + 40 - rate;

}

// Display results.

System.out.println("You earned $" + pay);

}

}

Explanation:

Public class Test {
public static void main(String[] args) {
new Circle9();
}
}
public abstract class GeometricObject {
protected GeometricObject() {
System.out.print("A");
}
protected GeometricObject(String color, boolean filled) {
System.out.print("B");
}
}
public class Circle9 extends GeometricObject {
/** Default constructor */
public Circle9() {
this(1.0);
System.out.print("C");
}
/** Construct circle with a specified radius */
public Circle9(double radius) {
this(radius, "white", false);
System.out.print("D");
}
/** Construct a circle with specified radius, filled, and color */
public Circle9(double radius, String color, boolean filled) {
super(color, filled);
System.out.print("E");
}
}
The answer is BEDC but how did it come about?

Answers

Answer:

| Circle9(), System.out.print("C");

| Circle9(double radius), System.out.print("D");

| Circle9(double radius, String color, boolean filled) System.out.print("E");

| GeometricObject(String color, boolean filled) System.out.print("B");

Starting From The Bottom -------------------------------

Explanation:

Just debug it.

But you'll get BEDC due to the code arrangement.

In your main: new Circle9();

So, let's go to Circle9()

-----------------------------------------

public class Circle9 extends GeometricObject {  

public Circle9() {

this(1.0);

System.out.print("C");

}

--------------------------------------------------

We need to head to Circle9(double radius) because this(1.0) was called, System.out.print("C"); will not be processed just yet

So, let's go to Circle9(double radius)

-----------------------------------------

public Circle9(double radius) {

this(radius, "white", false);

System.out.print("D");

}

--------------------------------------------------

Again, we need to leave this call and head to another, Circle9(double radius, String color, boolean filled), because of this(radius, "white", false); was called System.out.print("D"); will not be processed just yet

So, let's go to Circle9(double radius, String color, boolean filled)

-----------------------------------------

public Circle9(double radius, String color, boolean filled) {

super(color, filled);

System.out.print("E");

}

--------------------------------------------------

So here super is called which just calls the "parent"  GeometricObject(String color, boolean filled).

After that, B is outputted to Console

We then print out E

We then print out D

We then print out C

So.... more concise:

Run Through This Backwards

| Circle9(), System.out.print("C");

| Circle9(double radius), System.out.print("D");

| Circle9(double radius, String color, boolean filled) System.out.print("E");

| GeometricObject(String color, boolean filled) System.out.print("B");

The constructor calls create this chain

Name any four areas where computers are used​

Answers

Answer:

Computers are used for Business

Computers are used for Education

Computers are used for Science

Computers are used for Communication.

The keyboard shortcut to enter the current date in a field is
Ctrl+semicolon (;)
Ctrl+ampersand (&)
Ctrl+asterisk (*)
Spacebar

Answers

Answer:

oh cool I'm gonna try that

Iconic designs are inspirational and are often copied.

True

False

Answers

This is absolutely true. A shining example of this is with smartphones. Before Apple introduced the world to the iPhone, most smartphones had actual keyboards, zero touchscreen capabilities, could barely browse the internet, and had very small displays. After the iPhone was released in 2007, companies immediately scrambled to come out with phones that looked uncannily similar to Apple's. Why? Because Apple's phone was designed well. It's pretty amazing how immediate the shift was. In fact, I recomend you look up "Smartphones before and after iPhone" online. It's pretty cool. Here's an image example: https://www.redmondpie.com/image-showing-phones-before-and-after-iphone-x-revisits-how-android-market-still-tends-to-copy-iphone/

Hope this helps!

. Which responsibility belongs to the marketing function?

Answers

Answer:

The marketing functions involves various responsibilities of the business organization, these functions are responsible for the growth of company. The key roles and responsibilities of marketing functions are market research, finance, product development, communication, distribution, planning, promotion, selling etc.

Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion: A, B, and C = 2 D, E, and F = 3 G, H, and I = 4 J, K, and L = 5 M, N, and O = 6 P, Q, R, and S = 7 T, U, and V = 8 W, X, Y, and Z = 9 Write a program that asks the user to enter a 12-character telephone number in the format: XXX-XXX-XXXX. Acceptable characters (X's) are A-Z and a-z. Your program should check for: The length of the phone number is correct. The dashes are included and are in the correct positions. There are no characters in the illegal characters in the string. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. If the input string is not entirely correct then you should print an error message. For example, if the user enters 555-GET-FOOD the program should display 555-438-3663. If the user enters 123-456-7890, the program should display 123-456-7890. Rules: You must have one function (in addition to main()) that converts an alphabetic character to a digit. Or you can have one function that coverts all characters to digits. You can make your own function or use a built-in function if one exists.

Answers

Answer:

The program in Python is as follows:

def convertt(phone):

splitnum = phone.split ('-')

valid = True  

count = 0  

err = ""  

numphone = ""

if len(phone) != 12:

 err = "Invalid Length"  

 valid = False  

elif phone[3] != '-' or phone[7] != '-':

 err = "Invalid dash [-] location"  

 valid = False  

while valid== True and count < 3:

 for ch in splitnum[count]:

  if ch.isdigit():

   numphone += ch  

  elif ch.upper()in 'ABC':

   numphone += '2'  

  elif ch.upper()in 'DEF':

   numphone += '3'  

  elif ch.upper()in 'GHI':

   numphone += '4'  

  elif ch.upper() in 'JKL':

   numphone += '5'  

  elif ch.upper()in 'MNO':

   numphone += '6'  

  elif ch.upper()in 'PQRS':

   numphone += '7'  

  elif ch.upper()in 'TUV':

   numphone += '8'  

  elif ch.upper()in 'WXYZ':

   numphone += '9'

  else:

   valid = False

   err = "Illegal character in phone number"  

 if count!=2:

  numphone += '-'  

 count += 1  

if valid == False:

 print (err)

else:

 print ("Phone Number", numphone)

phone = input("Phone number: ")

convertt(phone)

Explanation:

See attachment for complete source code where comments are used for explanation

When the Credit Card Number box and the CSC box receive the focus, a transition effect should appear that slowly adds a glowing brown shadow around the boxes. The glowing brown shadow appears but without a transition effect. Return to the code8-4_debug.css file and study the code that applies a transition effect to both the input#cardBox and input#CSC objects, and the input#csc:invalid style. Correct any mistakes you find in the code. Verify that when the Credit Card Number and CSC boxes receive the focus a transition effect appears that adds the glowing brown shadow to the boxes.

Answers

Answer:

dire ako maaram hito because dire ako baltok

medyo la

give five example of secondary storage device, stating their function and storage capacity​

Answers

Answer:

Examples of secondary storage media include recordable CDs and DVDs, floppy disks, and removable disks, such as Zip disks and Jaz disks. Each one of these types of media must be inserted into the appropriate drive in order to be read by the computer

functions

The function of secondary storage is the long-term retention of data in a computer system. Unlike primary storage, or what we refer to as memory, secondary storage is non-volatile and not cleared when the computer is powered off and back on.

Which of these are examples of a bug?
A. Feedback telling you the game is boring. B. Players can get to the river, but nothing they click gets them over the river. C. The game crashes during game play. D. B & C

Answers

The answer is b and c

8. What's the output of this code?
1
def sum(x, y):
return(x+y)
print(sum (sum(1,2), sum(3,4)))

Answers

Answer:

10

Explanation:

[tex]sum(1,2) = 3\\sum(3,4) = 7\\sum(3,7) = 10\\[/tex]

Basically, sum((1+2) + (3+4)) = sum(3,7) = (3+7) = 10

HW3: Write a program in C language by using if statement for a lift control
system, for your information
nation the maximum weight is 240kg and for five floors.

Answers

160kg Is your answer

Suppose we define a WaitlistEntry as follows:

typedef struct{
int iPriority; /* Priority of the student to be enrolled */
int iStudentID; /* ID of the student */
}
WaitlistEntry;

Below are different implements of a function to create a WaitlistEntry from given iPriority and iStudentID data. Some of these implementations are flawed. Identify them and describe what is wrong with them briefly:

WaitlistEntry createWL( int iPriority, int iStudentlD )
WaitlistEntry w,
w.iPriority iPriority;
w.iStudentlD iStudentlD;
return w;

a. correct
b. incorrect, leaks memory
c. incorrect, syntax error
d. incorrect, data will be overwritten by next function call

Answers

Answer:

You have syntax errors, but I don't know if it happened when you posted this question, nevertheless

Explanation:

Correct code:

WaitlistEntry createWL( int iPriority, int iStudentID ) { // Opening Brace

WaitlistEntry w; // Should be ; not ,

w.iPriority = iPriority;   // Assign Missing

w.iStudentID = iStudentID; // Assign Missing

return w;

} // Closing Brace

// Also note: iStudentID this actually has an 'l' which is LD. Not ID, this is why I assume these errors happened when posting the question.

what is this....... Iam booking train to patna. ​

Answers

i agree w the person above

What was software for modems that connected through phone lines called?


virtual-emulation software

terminal-emulation software

bulletin-board software

baud modem software

Answers

Answer:

Best Regards to all of the people who have met you in the class

Variable Labels:
Examine the following variable names for formatting errors.
If it is not usable, correct it. If there are no errors, write good.
10. studentName
11. Student Address
12.110 Room
13. parentContact
14. Teachers_name

Answers

Answer:

10. 13. and 14. Correct

11. Incorrect

12. Incorrect.

Explanation:

The programming language is not stated. However, in most programming languages; the rule for naming variables include:

Spacing not allowedUnderscore is allowedVariable names cannot start with numbers

Using the above rules, we can state which is correct and which is not.

10. 13. and 14. Correct

11. Incorrect

Reason: Spacing not allowed

Correct form: StudentAddress

12. Incorrect.

Reason: Numbers can't start variable names

Correct form: Room110

What is the family access code right now?

Answers

I dont know I'm so sorry I cpuldnt help

Which of the following networks had these two goals: a) allowing scientists to work together on scientific projects; and, b) functioning even if part of the network was destroyed by a nuclear attack? W3C O IBMNet ARPANET NSFnet

Answers

Answer:

ARPANET

Explanation:

It was the ARPANET sponsored by the US Department of Defense to enable scientists collaborate on research.

Answer:

APPANET

Explanation:

market trends on products made of bamboo, wood, and metal​

Answers

Answer:

market trends on products made of bamboo, wood, and metal

Quail eggs, popcorns, hotdogs, sandwiches, ice creams, fries, sodas, juice, you name it. It can all be found near school community. Also, fun and exciting stuff can be found and are sold near schools. Keychains, pretty and fashionable headbands, ponytails, ribbons, and so much more are sold there.

in cell B5 create a formula using round function that rounds the value in cell G19 to an integer, with 0 decimal places

Answers

Answer:

=ROUND(G19, 0)

Explanation:

In Microsoft Excel you would need to click on cell B5 and then click the function bar at the top and paste the following formula

=ROUND(G19, 0)

This formula will grab whatever value is in cell G19 and round it to the nearest whole integer without any decimal places at all. This is handled by the ROUND() method which takes in two arguments, the first is the cell which has the value to be rounded, and the second argument is the number of decimal places to round to. 0 indicates no decimal places.

When adding delegates to his mailbox, which role should Joel use if he would like the user to be able to read and create items in a particular folder?
- editor
- publishing editor
- author
- manager

Answers

Answer:

publishing editor

Explanation:

In this scenario, the role that he should choose for the delegates would be publishing editor. This role will allow them to create, read, modify, and delete all items within a given folder, and create subfolders. The other options listed either do not give access to create/modify existing files or simply only give all these rights with files that the user creates but not files that already existed in the folder. Therefore, this would be the best role for what Joel wants to accomplish.

Consider the key success factors of B2C. Is it only IT? What is most important?​

Answers

Jsjfu zzer jsusuc888 kksss

How is an interpreter different from a compiler?
An interpreter translates and executes code line by line, while a compiler translates all code at once so that it is ready to be executed at any time.
An interpreter translates all code at once so that it is ready to be executed at any time, while a compiler translates and executes code line by line.
An interpreter translates programming code into binary language, while a compiler does not.
An interpreter translates binary language into programming language, while a compiler translates programming language into binary language.

Answers

Answer:

An interpreter is quite different from a complier due to the following statement below:

O. An interpreter translates and executes code line by line, while a compiler translates all code at once so that it is ready to be executed at any time.

Explanation:

For an interpreter, it works in translating and execution of the codes line after another line. In a situation where there is a mistake in the code, the next line would not be able to be executed, but rather display error message. On the other hand, compiler translate all codes at once and execute them as a single work.

During its translation of the codes in compiler, should there be any error, it would not be able to execute despite the fact that, the error might be in the last line of the code.

Answer:

a

Explanation:

taking test right now

Ask the user to input a country name. Display the output the message “I
would love to go to [country]”

Answers

Answer:

Explanation:

The following code is written in Python, it asks the user for an input saves it to a variable called country, and then prints out the sentence example in the question using the user's input. The output can be seen in the picture attached below

country = input("input country")

print('I would love to go to ' + country)

Other Questions
I tried this problem out but Im not sure if Im right also this is a test worth 100 points can someone show me if u made any mistake can j explain also ? 7. Creating some of the early animation devices will teach you how to think about moving images.A. TrueB. False Which of the following is a good example of inflation? OA. You get a raise and the price of gas goes down. OB. You get a second job and you increase your net income by 15%. O c. The price of gas went from $4.00 last month to $4.25 this month. OD. The price of gas goes down from $4,25 last month to So thir 2 Which quadratic function describes thegraphed parabola with zeros at x = 1 and x = 5?6541321-6543-2-10234 516-1- 2 F f(x) = -2(x - 3)2 + 8G f(x) = -2x2 + 12x - 10H f(x) = -0.5(x - 3)2 + 2J f(x) = -0.5x 3x - 6 U will be marked as Brainliest if u solve ex 1 only If you really struggled with biology in high school, and you know that your college is going to require you to get one academic creditin biology in order to graduate, what-according to this article's advice-should you do?es )A)Transfer to another college that does NOT require a biology credit.B)Attempt to major in biology so you can constantly work on your weakestsubject.Put off trying to earn your biology credit until the spring semester of yoursenior year.DRegister to take biology your first semester at college while your highschool biology is still fresh on your mind.Reading: Informational TextTR1.8.1) Textual EvidenceID: 12985Hint Which of the following is an equation of the circle with a center at (-1,4) and a radius of 25 units? plss pahelp namanA. x+ y+2x-8y-3=0B. x+y-2x-8y+3=0C. x+y+2x+8y-3=0D. x+y-2x+8y+3=0 A group of wolves is led by a male wolf and a female wolf. The two wolves lead the hunting and get to eat the captured prey first. They are the only wolves in the group who have pups. The other members of the group help to feed and care for the pups. The group works together to stop other wolves from entering the area where they live.Identify the social structure and describe the social behaviors of the wolves. Explain how these behaviors help the wolves survive. Why were Adams and Clay accused of making a corrupt bargain? A line goes through the points (7,8) and (7,8). Find its slope. An object attached to a spring is pulled across a horizontal frictionless surface. If the force constant (spring constant) of the spring is 45 N/m and the spring is stretched by 0.88 m when the object is accelerating at 1.4 m/s2. What is the mass of the object? helphelphelphelphelpiusnfdjchfrnkdnbh Read and choose the option that correctly answers the question.Antes del merengue que Juan Luis Guerra toca ahora con su banda, estaba el merengue tpico, que solo usaba los instrumentos musicales de cuerda. Gracias a Juan Luis Guerra, el merengue de ahora usa los instrumentos musicales de cuerda y los instrumentos musicales de percusin. Esto ayud a Juan Luis Guerra en 1991 a ganar su primer Grammy.Based on the text, what major difference did Guerra introduce to merengue? (2 points) 1: In addition to observable traits, scientists use ________ to classify living things.2: Its estimated that more than 2/3 of all classified organisms are insects. A(n) _________ is a scientist who specializes in studying insects. A chemical reaction happens in three steps.Step 1: AB+C (fast)Step 2: CD+E (slow)Step 3:D+AF (fast)What is the rate-determining step?Steps 1 and 3Steps 1 and 2Steps 2 and 3Step 3 onlyStep 1 onlyStep 2 only Write an explicit formula for the geometric sequence below and use it to find the 9th term. 256, 64, 16, 4, . . . 34. Find each of the following probabilities when n indepen- dent Bernoulli trials are carried out with probability of success p. a) the probability of no successes b) the probability of at least one success c) the probability of at most one success d) the probability of at least two successes Which is the better deal? *5 gallons of gas for $15.7011 gallons of gas for $42.00 An airplane flies 2720 km in 4 hours calculate the average speed in kilometers per hour? Which statement best explains the relationship among the three facts A the Meyer and Astec highly valued a bitter chocolate drink be today people around the world eat chocolate products made with sugar see natural chocolate has chemicals in it that make people feel good