Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'say,': 0.05; 'things.': 0.05; 'item.': 0.07; 'main()': 0.07; 'mentioned,': 0.07; 'subject:help': 0.07; 'python': 0.09; 'function:': 0.09; 'python:': 0.09; 'def': 0.10; 'times,': 0.13; 'dictionaries': 0.16; 'main():': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'wrote:': 0.17; 'typing': 0.17; 'trying': 0.21; 'supposed': 0.21; 'task': 0.23; "i've": 0.23; 'idea': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'first,': 0.27; 'list:': 0.27; 'post': 0.28; 'helpful.': 0.29; 'questions.': 0.29; 'second,': 0.29; 'case,': 0.29; 'covered': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'e.g.': 0.30; 'function': 0.30; 'figure': 0.30; 'stuff': 0.30; 'code': 0.31; 'clarify': 0.33; 'correctly.': 0.33; 'curious': 0.33; "he's": 0.33; 'anyone': 0.33; 'to:addr:python- list': 0.33; 'that,': 0.34; "can't": 0.34; 'agree': 0.34; 'done': 0.34; 'list': 0.35; 'pm,': 0.35; 'something': 0.35; 'but': 0.36; 'subject:Please': 0.36; "didn't": 0.36; 'two': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'skip:" 10': 0.40; 'received:192.168': 0.40; 'your': 0.60; 'most': 0.61; 'high': 0.61; 'first': 0.61; 'school': 0.61; 'customer': 0.61; 'repeat': 0.62; 'different': 0.63; 'email addr:gmail.com': 0.63; 'hear': 0.63; 'total': 0.65; "(don't": 0.84; 'basics.': 0.84; 'concepts,': 0.84; 'shopping': 0.87; 'subject:you': 0.88; 'items,': 0.91; 'response,': 0.93 Date: Wed, 26 Dec 2012 19:53:41 -0500 From: Mitya Sirenef User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Please help if you can! References: <7333128a-6866-4e3c-8436-d5b2397beadc@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356569625 news.xs4all.nl 6886 [2001:888:2000:d::a6]:44751 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35559 On 12/26/2012 07:04 PM, bobflipperdoodle@gmail.com wrote: > First, sorry for starting a new post - I didn't want anyone to have to read through the whole first one when the questions were completely different :/ > > Second, I honestly have no idea how to answer your questions. I am a sophomore in high school and I am trying to learn this on my own because my teacher is not very good at explaining things. > > i just cant figure out how to get the total when an order is placed without the customer ordering at least one of each item. I also can't figure out how to get the shipping to calculate correctly. It is an intro class and we are using just the basics. Most of what Mitya said is stuff I've never seen before, although I am very grateful for her response, I am supposed to use only what the teacher "taught". I'm sorry to hear that, I just want to clarify - the teacher did not yet cover the use of lists, dictionaries and functions? If that's the case, I have to agree with you that he's probably not a very good teacher because this task can be done much easier and better with those 3 concepts, all of which are very easy. If you are barred from using them, Joshua's post will be most helpful. If you are curious about the 3 concepts I mentioned, they are covered in the official python tutorial, but the quick rundown is: list: a list of items, e.g. a shopping list: shoplist = ["tea", "cake", "blueberries"] dictionary: a collection of keys/values, like words/definitions in a dictionary: shopping_cart = {"yoda": 3, "dvd": 5} # 3 of yoda figures, 5 dvds function: a way to group a bunch of code together: def main(): # do something # do something else # la la la main() The nice thing about functions is that if you need to repeat something, let's say, two thousand times, you just call the function two thousand times, e.g.: for x in range(2000): main() Which is much easier than typing in two thousand copies of the same code (don't ask me how I know!) - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/