Create a variable named dishes and use it to store a list

Assignment Help Other Subject
Reference no: EM133231238

Assignment - Computer Science Variable Creation Programming Question

Lab - Variables, types, and collections

Q1. Create a variable named dishes and use it to store a list of your 5 favorite dishes, in order of preference. Print this variable.

Q2. Using the data stored in the variable dishes, print a sentence that tells what is your first and fifth favorite dishes (e.g., Shish taouk is my favorite dish and stroganoff beef is my fifth favorite dish.).

Q3. Using the data stored in the variable dishes, create a new variable menu which maps (i.e., this would be a dictionary) the days of the week (key) with the dishes that you will eat (values) such that you eat your favorite meal on Monday, your second favorite meal on Tuesday, and so on. Print the variable menu.

Q4. Add two entries to your menu dictionary for Saturday and Sunday (with whatever dish you'd like).

Q5. If you wanted to know how many items you have in your list dishes, you could print len(dishes). Using this information, print a sentence like My list contains 23 dishes., where the number of dishes is the value returned by len(dishes)) (i.e., do not "hard code" the value 5; the printed value should update automatically if you were to add or remove items to the dishes list).

Q6. Do the same thing with the dictionary menu (i.e., print a sentence that says the number of items in menu).

Q7. list(menu.keys()) and list(menu.values() return lists of the keys (days of the week) and values (meals), respectively. Print the sentence This week, I will eat [shish taouk, pizza, ...]. listing the 7 meals contained in your dictionary menu.

Q8. Replace the meal you will eat on Wednesday with the meal you were planning to eat on Sunday. Then, delete the entry for Sunday in your dictionary and print the variable menu.

Q9. Create a dictionary variable_types that contains as key the name of your variables (i.e., dishes and menu) and as value their types. The type of a variable can be obtained by using type(my_variable) (to obtain the type of a variable named my_variable in this example). Print the dictionary variable_types.

Q10. Create a dictionary variables where the keys are the variable name (dishes and menu) and values are dictionaries. These "inner" dictionaries will have three keys: type, address, and content. The corresponding values should be the variable type (i.e., type(my_variable)), the variable address (can be obtained with hex(id(my_variable))), and the content of the variable. Print variables. It should look something like this (but all on one line).

{'dishes': {'type': <class 'list'>,

'address': '0x7f64f0578780',

'content': ['shish taouk', 'pizza', 'lazagna',

'spagetti', 'stroganoff beaf']

},

'menu': {'type': <class 'dict'>,

'address': '0x7f64e86be3c0',

'content': {'Monday': 'shish taouk', 'Tuesday': 'pizza',

'Wednesday': 'burger', 'Thursday': 'spagetti',

'Friday': 'stroganoff beaf', 'Saturday': 'hot dog'}

}

}

Reference no: EM133231238

Questions Cloud

How psychologists participated in addressing social issues : How have psychologists participated in addressing social issues and change? How has humanism, which focuses on each individual's potential
Ensure prompt and constant communication : Describe how you would ensure prompt and constant communication among the interdisciplinary team.
Identify a clinical issue and health problem : Identify a clinical issue, health problem, or service delivery issue of interest to you. Is there an aspect of this clinical issue, health problem
What other factors play into capital budgeting decisions : What other factors play into capital budgeting decisions? Do we always select those projects that have the highest return on investment (ROI)
Create a variable named dishes and use it to store a list : Create a variable named dishes and use it to store a list of your 5 favorite dishes, in order of preference. Print this variable
Significant challenges to social justice today : 1. What are some of the most significant challenges to social justice today? How are they different from the past?
Case study walmart de mexico : What organizational policies and professional guidelines should be considered? What kind of responsibility does Walmart have to its different stakeholders?
What are some of the underlying factors : Answer the following questions - What are some of the underlying factors (determinants) that are contributing to the poor health status in the US
Should the video footage be allowed as evidence : Police can use these cameras to videotape interventions and arrests. Videotapes can be reviewed for training purposes and used as evidence in court.

Reviews

Write a Review

Other Subject Questions & Answers

  Explain training requirements of powered industrial truck

Summarize the training requirements of the Powered Industrial Truck Standard. What challenges and problems, if any, do you see with meeting these requirements?

  What slippery slopes lie ahead regarding homeland security

What slippery slopes lie ahead regarding homeland security

  Examine what decisions might have already been taken

For this you are required to choose a building from the first half of the semester (Western architecture 1900AD to the present) and imagine that you are its.

  Discuss glatiramer acetate as it is losing its efficacy

Switch his interferon ß-1a to glatiramer acetate as it is losing its efficacy

  Discuss negative ethnic identity of persons of color

How do early personal experiences influence the positive or negative ethnic identity of persons of color? Can you think of a best example

  Identify two coaching skills that made a recent experience

Identify two coaching and two mentoring skills that made a recent experience a successful one for you. What differences did you note in the two approaches to managing performance?

  Prepare research paper on the rfid standards

This paper will be graded using the rubric available under the syllabus section. The grade will not be included in the final class grade but will provide the student with the opportunity to receive instructor feedback similar to the final paper.

  Care and have patience with your students

Share common interests with the students. Care and have patience with your students. Don't make assumptions about your students. Get into the students' reality.

  Conduct an environmental analysis on your organization

Conduct an Environmental Analysis on your organization. Investigate the world in which the organization will be operating. For example, unemployment, layoffs.

  Do you think you would have the courage to act as luther did

"I would never have thought that such a storm would rise from Rome over one simple scrap of paper...." Luther risked a tortuous death, but he continued to advocate for his beliefs. If a religious activist, do you think you would have the courage t..

  How would the readings of the gravitational pull compared

A gravity meter is used to compare the amount of gravitational pull at the Earth's north pole Inn at the earth's equator. How would these readings of the gravitational pull compared? Assume both readings are taken at sea level.

  Describe the ethical structure and violations

Describe the ethical structure and violations. For instance, was there a code of conduct? Why didn't it work? What was management like - were they ethical?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd