Create a very simple grocery list script

Assignment Help Python Programming
Reference no: EM132236346

Project - Grocery List

Introduction - Your task for this project is to create a very simple grocery list script. This script also emphasizes the importance of using lists, dictionaries and loop types within your script and how the use of those functions shapes your approach in creating a script.

The task is broken down into three sections:

1. User Input

2. Loop through the grocery list

3. Provide output to the console

Data Structure - The structure of the data for this project is extremely important.

Each grocery item is a dictionary with the following key-value pairs

  • a name of the grocery item with the key identifier 'name'
  • the number of grocery items purchased with the key identifier 'number'
  • the cost of the grocery item with the key identifier 'price'

grocery_history is a list of grocery item dictionary elements.

Task: Create the empty data structure

1. Create an empty dictionary with the variable name grocery_item.

2. Create an empty grocery_history list.

Grocery List Script -

Prompt - The list object type is one of the most important and frequently used types in a Python program. A list is a container, an object that groups related objects together. A list is also a sequence: The contained objects maintain a left-to-right positional ordering. Elements of the list can be accessed via indexing operations that specify the position of the desired element in the list. Each element in a list can be a different type, such as string, integer, float, or even other list.

A dictionary is another type of container object that is different from sequences like strings, tuples, and lists. Dictionaries contain references to objects as key- value pairs: Each key in the dictionary is associated with a value, much like each word in an English language dictionary is associated with a definition. Unlike sequences, the elements of a dictionary do not have a relative ordering of positions. Adding a value to a dictionary can be done either with brackets or using the keyword dict.

A programmer can use loops to execute the same code repeatedly as long as some condition is true. The loop expression is evaluated when the program reaches the loop statement. If the loop expression is true, then the indented code block, known as the loop body, is executed. At the end of the loop body, execution goes back to the while loop statement. The loop expression is evaluated again, and if true, the loop body is executed again. But, if the expression evaluates to false, then execution instead proceeds to code below the loop body. Each execution of the loop body is called an iteration, and looping is also called iterating.

Your task for this project is to create a very simple grocery list script. This script emphasizes the importance of using lists, dictionaries, and loop types within your script, and how the use of those functions shapes your approach to creating a script.

You will be working on this project in the Project Two: Grocery List Script module in Codio. Following the directions in that module, you will also be able to determine the exact placement of the comments you will need to make in the code. Follow the directions in the module in Codio to walk through the activity.

Your script and word response for this script should address the following critical elements:

I. In Your Script (Annotated Text File):

Refer to the directions in the module in Codio for how to export out and comment your completed script.

A. Identify examples of four uses of list operations in the script using comments in your code. Be sure your examples address each of the following:

i. Creating lists

ii. Adding and removing data from a list

iii. Accessing values in a list

iv. Modifying values in a list

B. Identify examples of four uses of dictionary operations using comments in your code. Be sure your examples address each of the following:

i. Creating dictionaries

ii. Adding and removing key-value pairs

iii. Accessing values using keys

iv. Modifying values

C. Identify examples of three uses of loop structures using comments in your code. Be sure your examples address each of the following:

i. Item-based for loops

ii. Index-based (range) for loops

iii. While loops

II. Applying Your Experience

Making mistakes when you learn to write code is common. It is part of learning. What is important is developing the skill of learning how to understand your errors and then fix them (debugging). For this part of your final project, you will respond to the following:

A. Reflecting on your experience with this activity, explain the importance of knowing how and when to use lists, dictionaries, and loop types.

Support your response with examples from the activity of the types of errors and your method for fixing them.

Note - This is a codio project. In addition to notes provided, which are there to explain the steps necessary to complete the project, explain each step of the process. Also need a 1 paragraph reflection on all of the problems that were encountered and what was learned through the process.

Attachment:- Assignment File.rar

Reference no: EM132236346

Questions Cloud

Relationship between organizational structure and culture : What is the relationship between organizational structure and culture? Provide examples and/or resources to defend your position.
The difference between a current and a long-term liability : What is the difference between a current and a long-term liability? Provide an example of each in the healthcare sector.
Focuses on the goals of society : 1 An insurance professional who focuses on the goals of society instead of his or her own goals is best serving the needs of which one of the following groups?
Do you see any ethical issues emerging out of health care : Examine one of the policy statements provided by "ACHE" and comment on how this code may differ in nature than the health care provider codes.
Create a very simple grocery list script : Introduction - Your task for this project is to create a very simple grocery list script. Create an empty dictionary with the variable name grocery_item
What is the probability that no customers are in system : What is the probability that no customers are in the system (Po)? What is the probability that no customers are in the system (Po)?
What musical features and social history set bluegrass apart : What musical features and social history set bluegrass apart from other types of country music? Give examples where appropriate
Why are planning and budgeting so important : Why are planning and budgeting so important to an organization's success? Reflect back on the topics covered in the course.
Describe current level of listening and non-verbal skills : BUS 311 – Managerial Communications - post university - Develop a PowerPoint focusing on five attractions. In addition to developing strong slides

Reviews

len2236346

2/17/2019 8:50:23 PM

Instructions: Please see the attachment for complete details. This is a codio project. In addition to notes provided, which are there to explain the steps necessary to complete the project; The writer will need to add notes to explain each step of the process. I also need a 1 paragraph reflection on all of the problems that were encountered and what was learned through the process. As you work through the project guide, be aware that before you submit the script draft you will need to add comments to meet the requirements found in the IT-140 Project Two Guidelines and Rubric: Grocery List Script Draft document. Although these comments can be added after you complete the guide, you will likely find it useful to add as much as possible while you work through the script.

len2236346

2/17/2019 8:50:16 PM

Guidelines for Submission: Your submission should include all annotated text files of code for the script, as well a Microsoft Word document that includes the reflection part of your assignment in which you explained the problem-solving approaches you employed (critical element II).

len2236346

2/17/2019 8:50:10 PM

Grading Guidelines - Identifies examples of four uses of list functions in the script using comments in your code. Identifies examples of four uses of dictionary functions using comments in your code. Identifies uses of loop functions using comments in your code. Explains the importance of knowing how and when to use lists, dictionaries, and loop types, and explanation is supported with examples from the activity about the types of errors and your method for fixing them. Submission is free of errors related use of citations, grammar, spelling, syntax, and organization and is presented in a professional and easy-to-read format.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

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