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

  Competing interests of large and small states

How do the differences between the House and Senate represent the competing interests of large and small states?

  Discuss the nature vs nurture controversy

Discuss the "nature vs. nurture" controversy. Define each term and the types of research that should provide data to support each argument

  Explain the effect of the environmental movement

Explain the effect of the environmental movement on the process of industrialization in the United States during the 1970s.

  How stakeholder influenced the situation in a positive way

Discuss how technologies or information systems have contributed to the problem and how you will propose technology be implemented into the solution.

  Describe and summarize the backward mapping

Describe and summarize the backward mapping and frontward mapping research options - Which research option do you think is better in general, and why

  Identification of clear learning targets

Professional Learning Communities (PLCs) provide opportunity for analysis of data and enhancement of data-driven decision making, particularly as it relates to curriculum choices and changes. The identification of clear learning targets

  Identify a social problem working with maternal and infants

The Assignment (2-3 pg): o Identify a social problem working with maternal and infants. o Explain rational for selecting social problem

  The concept of income tax

The concept of Income Tax was created which was the same year as the creation of the Federal Reserve System.

  How does this fictitious product stack up against

How does this fictitious product stack up against the Dietary Guidelines? What information is missing?

  Why does police brutality occur and who is the victim

Why does Police Brutality occur and who is the victim? What would the significance of these results be to the field or to practical criminal justice concerns?

  Review problem on gender-typed behaviors

In one article, gender-typed behaviors were explored in relation to whether or not they remained stable from infancy and throughout early childhood.

  Identify the scope of an investigation

As we have discussed, a good LSQ is an effective rhetorical tool for scholars to identify the scope of an investigation. Remember, when writing an LSQ.

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