Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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: UNSURE 0.208 X-Spam-Level: ** X-Spam-Evidence: '*H*': 0.59; '*S*': 0.00; '(using': 0.07; 'variables.': 0.07; 'python': 0.09; 'command.': 0.09; 'do,': 0.15; 'wrote:': 0.17; 'variables': 0.17; 'saying': 0.18; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'represent': 0.28; 'end,': 0.29; 'case,': 0.29; 'lists': 0.31; 'not.': 0.32; 'running': 0.32; 'adjust': 0.33; 'int': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'list': 0.35; 'pm,': 0.35; "won't": 0.35; 'something': 0.35; 'there': 0.35; 'except': 0.36; 'but': 0.36; 'should': 0.36; 'thank': 0.36; 'ok,': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'several': 0.39; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'help': 0.40; 'your': 0.60; 'different': 0.63; 'subject:...': 0.63; 'email addr:gmail.com': 0.63; 'total': 0.65; 'sum': 0.66; 'today': 0.67; 'header:Reply-To:1': 0.68; 'hotel,': 0.71; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'calculations': 0.84; 'occupied': 0.84; 'rooms': 0.84; 'obvious,': 0.91; 'hand,': 0.97 Date: Tue, 01 Jan 2013 15:28:27 -0500 From: Dave Angel 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: Considering taking a hammer to the computer... References: <2f5053ab-a646-49d3-a569-61468f518b9f@googlegroups.com> <39abb4d2-277a-4ac9-8574-0d3e3751b7ef@googlegroups.com> In-Reply-To: <39abb4d2-277a-4ac9-8574-0d3e3751b7ef@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:RcrSPTwFbYixABdl7R20NXEZqho6/5efhQCZLu6fWjn AtlNjWNHtJ7+pvuSB5OBm57cgU7EhTL+BOt4KlyucHwD8tVwr9 EKDogLzRF4DH0G/D63Wrzf5laBa6Gp4Qz0uCbV4VjMtpl0FeBd yt1bnbOshd88x8vm7vhHl8oR5GC+PjSMSPaZtr55B9JVorEW83 Vug3MTI05O25biRbyzVfLjFG/D6hNw5TK+J1pfLkYO/YEa8v1O ylAR6mvn/u6rE43Y+NshA5ZWMuqOxI1T1d7FNGWZjCZ+1bWhat kwa4rC7/IKTVGrCPLc4sg9g0WMX0mqwU5gbebqAMA3yHoEsNg= = X-Mailman-Approved-At: Wed, 02 Jan 2013 01:05:11 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357085112 news.xs4all.nl 6871 [2001:888:2000:d::a6]:56442 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35935 On 01/01/2013 03:14 PM, worldsbiggestsabresfan@gmail.com wrote: > OK, thank you all for your help yesterday! > > Here's where we are today (using python 3.3.0) > > He has everything running well except for the final calculations - he needs to be able to total the number of rooms in the hotel, as well as the number of occupied rooms. We have tried several different things and can't come up with a successful command. Any help you can give will be much appreciated!! There are two ways to get those totals, depending on whether you know how to work lists or not. If you do, then you should make a list of occupied_rooms, and sum() it at the end, and make a list of rooms_on_flow, and sum that at the end. But as you discovered, sum() won't work on an int (BTW, you should give the entire traceback instead of saying "doesn't work". In this case, it was obvious, but it might not be.) On the other hand, if you don't know what a list is, then you need to accumulate those numbers as you go. Either way, you need extra variables to represent the whole hotel, and you need to do something inside the loop to adjust those variables. -- DaveA