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

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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