how to exit from a nested loop in python

2019-02-07 Thread Kaka
for i in range(len(A.hp)): for j in range(len(run_parameters.bits_Mod)): req_slots[j] = math.ceil((A.T[i]) for g in Temp[i]["Available_ranges"][j]: for s in range(g[0], g[-1]): if (s+req_slots[j]-1) <= g[-1]: if (Temp[i]['cost'][

Re: Python program to phone?

2019-02-07 Thread Michael Torrie
On 02/07/2019 09:00 PM, Steve wrote: > BeeWare looks as if it requires Java, does it? > Is it exclusively java? Kind of. You do your coding in Python, then that's compiled to python byte code, which is then translated to Java byte code. You'll need the Android SDK, even if you're not using Java

RE: Python program to phone?

2019-02-07 Thread Steve
BeeWare looks as if it requires Java, does it? Is it exclusively java? = Footnote: Zamboni locks up after running into large patch of loose teeth. -Original Message- From: Python-list On Behalf Of Mario R. Osorio Sent: Tuesday, February 5, 2019 8:58 AM To: python-list@py

Re: The sum of ten numbers inserted from the user

2019-02-07 Thread Ben Bacarisse
Grant Edwards writes: > On 2019-02-07, Ben Bacarisse wrote: >> Ian Clark writes: >> >>> This is my whack at it, I can't wait to hear about it being the wrong big o >>> notation! >>> >>> numbers=[] >>> >>> while len(numbers) < 10: >>> try: >>> chip = int(input('please enter an intege

Re: The sum of ten numbers inserted from the user

2019-02-07 Thread Ben Bacarisse
Bart writes: > On 07/02/2019 20:45, Ben Bacarisse wrote: >> Ian Clark writes: >> >>> This is my whack at it, I can't wait to hear about it being the wrong big o >>> notation! >>> >>> numbers=[] >>> >>> while len(numbers) < 10: >>> try: >>> chip = int(input('please enter an integer:

Re: Python program to phone?

2019-02-07 Thread Jack Dangler
On 2/4/19 3:20 PM, Steve wrote: I have written my first python program (600 lines!) to help control my blood sugar and it has been so successful that my A1c dropped form 9.3 to an impressive 6.4. It will be much more useful if I had it on my phone. (MotoG, Android) The .py file reads/writes t

Re: The sum of ten numbers inserted from the user

2019-02-07 Thread Grant Edwards
On 2019-02-07, Ben Bacarisse wrote: > Ian Clark writes: > >> This is my whack at it, I can't wait to hear about it being the wrong big o >> notation! >> >> numbers=[] >> >> while len(numbers) < 10: >> try: >> chip = int(input('please enter an integer: ')) >> except ValueError: >>

Re: The sum of ten numbers inserted from the user

2019-02-07 Thread Ben Bacarisse
Ian Clark writes: > This is my whack at it, I can't wait to hear about it being the wrong big o > notation! > > numbers=[] > > while len(numbers) < 10: > try: > chip = int(input('please enter an integer: ')) > except ValueError: > print('that is not a number, try again') >

RE: The sum of ten numbers inserted from the user

2019-02-07 Thread Schachner, Joseph
I just realized that input has changed in Python 3 and I was using Python 2.7.13 with from __future__ import print_function and some others, but not that. In Python 3 the int( ) or float( ) cast is necessary because input( ) does what raw_input( ) did in Python 2; raw_input( ) name is therefore r

Re: The sum of ten numbers inserted from the user

2019-02-07 Thread Ian Clark
This is my whack at it, I can't wait to hear about it being the wrong big o notation! numbers=[] while len(numbers) < 10: try: chip = int(input('please enter an integer: ')) except ValueError: print('that is not a number, try again') else: numbers.append(chip)

RE: The sum of ten numbers inserted from the user

2019-02-07 Thread Schachner, Joseph
Well of course that doesn't work. For starters, x is an int or a float value. After the loop It holds the 10th value. It might hold 432.7 ... It is not a list. The default start for range is 0. The stop value, as you already know, is not part of the range. So I will use range(10). In the

RE: timezones

2019-02-07 Thread David Raymond
I'd say if the documentation mentions it, but doesn't say why, then we're not gonna be able to do much better for you as far as "why" goes. http://pytz.sourceforge.net/ "Unfortunately using the tzinfo argument of the standard datetime constructors "does not work" with pytz for many timezones."

Re: Implement C's Switch in Python 3 [OT languages]

2019-02-07 Thread Christian Gollwitzer
Am 05.02.19 um 02:20 schrieb DL Neil: So, even with the French making their dates into sentences, not a single one uses ordinals! - did the computer people in all these languages/cultures decide that the more numeric approach was better/easier/... (ie simpler/less-complex) :) For the two lan

timezones

2019-02-07 Thread Jaap van Wingerde
I made a small script to practise with timezones: #!/usr/bin/env python3 # -*- coding: utf_8 -*- from datetime import datetime, timedelta from pytz import timezone import pytz amsterdam_datetime = datetime(2018, 12, 17, 11, 31, 26, tzinfo=timezone('Europe/Amsterdam')) print(amsterdam_datetime) utc

Re: The sum of ten numbers inserted from the user

2019-02-07 Thread Joel Goldstick
On Thu, Feb 7, 2019 at 6:31 AM ^Bart wrote: > > I thought something like it but doesn't work... > > for n in range(1, 11): > x = input("Insert a number: ") The above, keeps replacing x with each input value. You don't want that. Think about appending the input value to a list > > for y in

The sum of ten numbers inserted from the user

2019-02-07 Thread ^Bart
I thought something like it but doesn't work... for n in range(1, 11): x = input("Insert a number: ") for y in range(x): sum = y print ("The sum is: ",y) -- https://mail.python.org/mailman/listinfo/python-list

Re: Loop with else clause

2019-02-07 Thread DL Neil
Further to our discussion of how to improve a code review's discovery of the mistaken handling of a for...else... construct:- Yesterday was a national holiday, but today gave some opportunity to research. Way back in 2009 there was spirited discussion over on the Python Ideas list (warning, e