Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #105187
| From | Jussi Piitulainen <jussi.piitulainen@helsinki.fi> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Beginner Python Help |
| Date | 2016-03-18 09:44 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <lf537roxmb0.fsf@ling.helsinki.fi> (permalink) |
| References | <101edd27-17e1-497c-a60f-fa56b033563b@googlegroups.com> <mailman.303.1458285656.12893.python-list@python.org> |
Terry Reedy writes: > On 3/18/2016 3:04 AM, Alan Gabriel wrote: ... >> list1=(num.split()) > > list1 is a list of strings > >> maxim= (max(list1)) >> minim= (min(list1)) > > min and max compare the strings as strings, lexicographically > >> print(minim, maxim) ... > You failed to convert strings of digits to ints. Try > > list1 = map(int, num.split) > > This will raise TypeError on strings that cannot be converted. Written in a hurry? :) Surely it'll raise something about a method not being iterable, and when that is fixed, something about not being able to invent a minimum for an empty sequence. list1 = list(map(int, num.split()))
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Beginner Python Help Alan Gabriel <alanunny@gmail.com> - 2016-03-18 00:04 -0700
Re: Beginner Python Help Terry Reedy <tjreedy@udel.edu> - 2016-03-18 03:20 -0400
Re: Beginner Python Help Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-18 09:44 +0200
Re: Beginner Python Help Chris Warrick <kwpolska@gmail.com> - 2016-03-18 08:23 +0100
Re: Beginner Python Help Ben Finney <ben+python@benfinney.id.au> - 2016-03-18 18:26 +1100
Re: Beginner Python Help "Martin A. Brown" <martin@linux-ip.net> - 2016-03-18 00:50 -0700
csiph-web