e: int) -> list:
return ( lst[x:x+size] for x in range(0, len(lst), size) )
Omitting the square brackets turns this into a generator expression. It
returns an iterator instead of a list, which functions like the
generator function I sketched, and generates the c
ting out that they should not
I think you're not using "nesting" the way I think of it. Can you
provide an example bit of code illustrating what you're thinking of and
explaining your concerns? Also, your paragraph looks a little truncated.
On 14Aug2019 11:15, Steven D'Aprano wrote:
On Wed, Aug 14, 2019 at 09:58:35AM +1000, Cameron Simpson wrote:
On 11Aug2019 22:58, James Hartley wrote:
>I am lacking in understanding of the @staticmethod property.
>Explanation(s)/links might be helpful. I have not found the descript
x27;m getting an area function from a nicely named class. (Also, I
wouldn't have to import the area function explicitly - it comes along
with the class nicely.)
So the static method is used to associate it with the class it supports,
for use when the caller doesn't have an instance to
message.
If you move your misplaced "return to_ints(nums), to_ints(nums2)"
statement up into the get_numbers function you should be better off,
because then it will return a list of numbers, not strings.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
re precise than
loose verbal descriptions alone).
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ven your description.
Unless they're snapshots/samples, in which case "Telemetric" ?-)
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
r would not have a callable to work with; it would get the None
that your @collect returns.
This is the other argument for always returning a callable: to
interoperate with other decorators, or of course anything else which
works with a callable.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
uot;py" command (I'm not on Windows here). So it may be that when
you issue the command "python" it isn't running the Python interpreter
but something else.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
your initialiser cannot complete correctly.
Consider:
x = Foo()
After this assignment we expect "x" to be a usable instance of Foo. We
don't put special checks; what would such checks look like? (There are
some answers for that, but they're all poor.)
does one write a one element tuple? Like this:
(9,)
Here the trailing comma is _required_ to syntacticly indicate that we
intend a 1 element tuple instead of a plain "9 in parentheses") as in
the earlier assignment statement.
I'm not sure an
as found.
To turn all this into a subscriptable list, define the __getitem__
method as a function accepting an index. If that index is an int, just
return that element. If the index is a slice (start:stop:stride), call
the more complicated function to return multiple elements.
ing to Flask and the environment: because a Flask app is often
invoked from within a web server instead of directly, it isn't feasible
to pass it "command line" arguments to control it. So the environment
becomes the most convenient place for ad hoc special settings.
Cheers,
Cameron
you'd need an SQLite library for PHP, but I cannot
believe that one does not exist. (Or you could also write your web
application in Python instead of PHP.)
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or chan
ly depending on what data structure is
used to arrange the data, because some actions are cheap in some
structures and expensive in others, so you choose the efficient action
where possible.
Cheers,
Cameron Simpson
___
Tutor maillist - Tut
at this point.
He has, as it happens, over in fl...@python.org.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ly true. In the extreme case you just treat the
first loop specially:
first = True
while first or the-actual-condition:
... do stuff ...
first = False
if you want to use "first" during the "do stuff". Or you could be a bit
more reliable and go:
first_test = True
:
words = text.split()
for i in enumerate(words):
Word = ' '.join(words[:i])
print (word)
answer = input('Keep word (ynq)?')
if answer == 'n':
continue
elif answer = 'q':
break
for i, v in enumerate(description):
if word in description[i]:
description.pop[i]
The inner for loop still has all the same issues as before. The outer
loop is now more robust because you've iterating over the copy.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
e of the other
Pis? Though given "Network is unreachable" I'd guess no packets get sent
at all.
I repeat my disclaimer: I've not used an ad hoc wifi network.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
his list drops attachments). That we we can all run
exactly the same code, and solve your actual problem.
And start always using:
from __future__ import print_function
in Python if you're using print. That will make your prints behave the
same regardless if whether they are using Python 2 or 3.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
if m:
category = m.match(1)
id_number = m.match(2)
recipient = m.match(3)
else:
m = re.match(...)
... more tests here ...
...
...
else:
... report unmatched line for further consideration ...
3: You use ".*" a lot. This is quite prone to matching too much. You
might find things like "\S+" better, which matches a single
nonwhitespace "word". It depends a bit on your input.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
't yours. There should be a Windows equivalent for probing a
process.
The converse part where you start the process includes this:
P = subprocess.Popen(.) # start the program
with open(pid_filename, 'w') as pidf:
print(P.pid, file=pidf)
to update the process id fi
Windows dropins for this facility. Maybe install this package:
https://pypi.org/project/pyreadline-ais/
maybe with "python -m pip install pyreadline-ais".
Then use it according to the documentation for the stdlib readline
module:
https://docs.python.org/3/library/readline.html#mo
in
a local file.
It is hard to be any more specific without knowing what you consider a
task, and how you'd check if it was active.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
//github.com/threatstack/libmagic
3: https://pypi.org/project/python-magic/
4: https://pypi.org/search/?q=magic
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
(look it
up). But a since pass over the list isn't enough to sort the whole
thing.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
dy of
the message.
Googling has not helped me to find a solution [...]
1: I recommend duckduckgo instead of Google for privacy/tracking
reasons.
2: When I search, I tend to find people with the same problem, not
necessarily people with answers. But this question might be hard to get
se cut/paste is very
fast (iTerm3 has a mode like most X11 apps: select implicitly copies, so
no Cmd-C copy keystroke for me either).
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
The biggest change you'll find coming from Java is likely the typing:
Python _values_ are strongly typed, but the variables are not - they can
refer to a value of any type. And there aren't really Java interfaces.
However, there are lint tools to look for issues like this.
Oh yes:
_date[date] += 1
A defaultdict is a dict which magicly makes missing elements when they
get access, using a factory function you supply. Here we're using "int"
as that factory, as int() returns zero.
I presume you've got the timestamp => date conversion
simply
the row from the CSV data as a first cut).
The nice thing about a namedtuple is that the values are available as
attributes: you can use "key.flavour" etc to inspect the tuple.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
aged install and just do
it all from scratch.
I suspect this has something to do with me interrupting the install process,
because I interrupted it precisely when it was fetching the package that it
can't find now.
Let me know if I should be asking this elsewhere.
Thi
foo = Foo()
print("age =", foo.age)
@property arranges this using descriptors: in the example above it
arranges that the class "age" attribute is a descriptor with a __get__
method.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
=0, /)
Return the sum of a 'start' value (default: 0) plus an iterable of numbers
When the iterable is empty, return the start value.
This function is intended specifically for use with numeric values and
may reject non-numeric types.
Cheers,
Cameron Simpson
__
quot;Using Django" list there.
There's a guideline to posting here:
https://code.djangoproject.com/wiki/UsingTheMailingList
but your post looks fairly good on the face of it.
Hoping this helps,
Cameron Simpson
Objective : display main page with multiple links to other pages. Use
j
roup(1,2,3,4)
year = int(year)
month = int(month)
day = int(day)
# turn this into a datetime.date object
date = datetime.date(year, month, day)
and return the computed date. Then just keep this in the for loop so it
is obvious what's going
nested
functions, but did not know it worked for lambdas as well.
Lambda are functions. Same rules.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
as defined: the
scope at the bottom of your programme.
This is called a "closure": functions has access to the scope they are
define in for identifiers not locally defined (eg in the parameters or
the function local variables - which are those assigned to in the code).
This means you
tartswith('/'):
raise ValueError("must be an absolute path")
with open(input_file, 'rb') as f:
return io.BytesIO(f.read())
Because of the Pfx the ValueError gets the input_file value in question
prefixed automatically, so you don
lues:
would be accepted. Which may be ok, and it should certainly be ok for
your first attempt: tighten things up later.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ou tell me what kind of system you have?
For variety, in my own code I keep the tests for foo.py in foo_tests.py,
the better to be seen next to foo.py in listings and file completion.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To u
and learn...
The octothorpe is only a comment marker at the start of a word.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
quot;) contains only the library, not header files or
doco wanted for development.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
er on the screen is changed to
the new background rendition.
ยท Wherever the former background character appears, it is changed
to the new background character.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ust the one from the int()
call, so it needn't indicate bad user input, it could as easily indicate
some subsequent bug in your code, as many functions can raise ValueError
if they are handed something unsatisfactory.
Cheers,
Cameron Simpson
___
eFilm(name, platform, dateAdded, tpe):
return Film(name, platform, dateAdded)
Unless there's more stuff happening in these functions which you've
stripped out for clarity you could just call the object constructors
directly from the if statements:
if data['tpe'] == 'Game':
a = Game(name, platform, dateAdded)
game = {a: tpe}
media.append(game)
Why would I only get one object in media, even though all three are
created?
As you may gather, all three input lines are processed, but only one
gets turned into an object to add to media. Change the if/if into an
if/elif/else and see if things become more obvious.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
s_term_resized, resizeterm and the "internal" resize_term
functions are recent additions :-) From "man 3 resizeterm":
This extension of ncurses was introduced in mid-1995. It was
adopted in NetBSD curses (2001) and PDCurses (2003).
Cheers,
Cameron Simpson
notices changes
automatically then it is uncommon to need to call resizeterm().
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 24Feb2019 14:30, boB Stepp wrote:
On Sun, Feb 24, 2019 at 1:39 AM Cameron Simpson wrote:
It looks like the resizeterm() function updates the curses _internal_
records of what it believes the physcial terminal size to be. When you
physically resize a terminal the processes within it
iced).
Does this clarify things for you?
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 27Jan2019 10:30, Peter Otten <__pete...@web.de> wrote:
Cameron Simpson wrote:
Mats has mentioned the modules getopt and argparse etc. These are
primarily aimed at option parsing ("-v", "-o foo"). Your situation
occurs _after_ the option parsing (in your case, th
sability: the above code complains about
each issue it encounters, and finally quits with an additional message.
In a real programme that addition message would include a "usage"
message which describes the expected arguments.
Cheers,
Cameron Simpson
ext pattern exercise which I always
have struggled with. Last language I did this in was Perl and had all
sorts of headaches. ๐ Python seems cleaner from the reading I have
done thus far. Lets see what challenges wait in front of me.
I used to use Perl extensively. I put off moving to Python for
t, not it cannot be current.)
But first, fine out what's wrong. Try the type test I suggest and see
how far you get.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
oosely speaking, safe:
thread1:
print(sorted(object))
thread2:
print(sorted(object,reverse=True))
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/m
f range characters -- ordinals >= 256 -- in a "byte"
string).
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
())
File "/home/srinivasan/Downloads/bt_tests/qa/test_library/Bt.py",
line 74, in bluetooth_scan
print("the value", res[1])
IndexError: list index out of range
Well, you've printed your list:
['Scanning ...']
It is a single
MAC, value the name). Return the dictionary.
If the dictionary is empty, there were no devices.
Not that like almost all collections, empty dictionaries are "false", so
you can go:
bluetooth_devices = scanner.bluetooth_scan()
if not bluetooth_devices:
... no devices found ...
C
, and the output from your programme
- a complete transcript of any error message, for example if your
programme raised an exception
Make sure these are inline in your message, _not_ attachments. We drop
attachments in this list.
Cheers,
Cameron Simpson
_
you're
working in bytes or text (str). Keep the division clean, that way all
you other code can be written appropriately. So: the command pipe output
is bytes. COnvert it to text before passing to your text parsing code.
That way all the parsing code can work in text (str) and have no we
..
print(s, file=sys.stderr)
raise
i.e. report some special message, then _reraise_ the original exception.
In this way he gets to keep the original exception and traceback for
debugging, which still making whatever special message he wanted to
make.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
code using your example and give it another try, I will make sure to let
you know if I run into any issues or additional questions. :)
Questions are welcome.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscri
r thread in threadPool:
sem.acquire()
thread.start()
# wait for collection to complete
collector.join()
def collect(q, ids):
for count in range(len(ids)):
id = q.get()
sem.release()
so that you acquire the semaphore before starting each thread, and
release the semaphore as thr
above. It is
useful so that people know what various discussions are about.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ing1[j-1])
a = mo.group()
print a
print os.getcwd()
break
Please advice how to proceed.
mo.group() returns the whole match. The above seems to look for the
string 'ERR2' in a line, and look for a patch number in the previous
line. I
see something
weird.
And I have no idea what happens on Windows.
I'd sort of expect Windows terminals, even cmd.exe, to accept the ANSI
sequences, which is what vt100 and xterms use. But that is expectation,
not knowledge.
Cheers,
Cameron Simpson
_
viously contrived, and the sleeps are so you can see
it all happen. But you can slot this into simple terminal based
programmes to present dynamic progress.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change su
On 06Nov2018 15:50, Joseph Gulizia ", count)
You should see that the expected code is actually reached and run, and
if it isn't, the corresponding print()s do not happen.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To u
quot;, count, "target_int =", target_int)
... read the int ...
if isint == True:
print("isint is true!")
ints.append(new_int)
count += 1
print("count =>", count)
You should see that the expected code is actually reached and run
u can find that with os.path.getctime() (or several
>other options, eg os.stat)
Do not use ctime, it is _not_ "creation" time. It is "last change to
inode" time. It _starts_ as creation time, but a chmod or even a
link/unlink can change it: anything that changes the metad
On 23Oct2018 11:24, Peter Otten <__pete...@web.de> wrote:
Cameron Simpson wrote:
The doco for mktemp (do not use! use mkstemp or the
NamedTemporaryFile
classes instead!) explicitly mentions using delete=False.
Well, "permanent temporary file" does sound odd.
By the way, Na
ts of the
config file". Which lets the user keep a tiny config file modifying only
the stuff which needs tweaking.
Utilities:
I my opinion, unless they shift with you app it is the end user's job to
have these in the execution path ($PATH on UNIX). If you app/packag
classes instead!) explicitly mentions using delete=False.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
n all operating systems?
The doco reads that way to me.
However, NamedTemporaryFile is a (nice) wrapper for tempfile.mkstemp().
Why not use that directly?
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subsc
eneficial to inspect.
It at least gets you objective information about where your programme
spends its time. It is limited by the data you give your programme: toy
example input data are not as good as real world data.
Finally, some things are as efficient as they get. You _can't_ always
vert back into bytes.
The easy way is to just accrue the bytes into a value as you read them:
n = 0
for b in the_bytes:
n = n<<8 + b
if you're reading "big endian" data (high ordinal bytes come first).
So read them in, accruing the value into "n".
ing of your target text
=> decode to a Python str
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
rns
all_together returns
So both are type 'list' which is referred to here :
https://infohost.nmt.edu/tcc/help/pubs/python/web/sequence-types.html
as a valid sequence type but apparently there's a detail I'm still missing...
Yeah. byt
On 09Sep2018 23:00, Chip Wachob wrote:
On Sat, Sep 8, 2018 at 9:14 PM, Cameron Simpson wrote:
Actually he's getting back bytearray instances from transfer and wants to
join them up (his function does a few small transfers to work around an
issue with one big transfer). His earlier co
ay( (1,2,3,65,66) )
print(repr(bs))
print(hexlify(bs))
[...]
faffing is a new term, but given the context I'm guessing it is
equivalent to 'mucking about' or more colorful wording which I won't
even attempt to publish here.
You are correct:
https://en.wikipedia.org/wi
7;foobah')
And he's working with bytearrays because the target library is Python 2, where
there's no bytes type.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 08Sep2018 20:01, Cameron Simpson wrote:
So, if I'm understanding the transfer() function correctly, the
function takes and returns a bytearray type.
It would be good to see the specification for the transfer function.
They we can adhere to its requirements. Can you supply a URL?
y Python 3 deals with
chunks of bytes. A "bytes" is readonly and a bytearray may have its contents
modified. From a C background, they're like an array of unsigned chars.
I'm going to try the experiment you mentioned in hopes of it giving me
a be
I'm obviously missing something fundamental here. Problem is I can't
seem to find any examples of people asking this question before on the
inter-webs..
You have the opposite of my problem. I can often find people asking the same
question, but less often an answer. Or a decent answ
weather = ForecastIO.ForecastIO( api_key, latitude=coords[0],
longitude=coords[1] )
daily = FIODaily.FIODaily(weather)
for day in range(2,7):
day_data = daily.get_day(day)
csvw.writerow([city, day_data['temperatureMax'],
day_data['temperatureMin
forum seems the nicest and most helpful I've encountered.
The output of a CGI script should be a valid HTTP response: you need some HTTP
headers describing the output format and _then_ the core programme output. The
minimal header is a Content-Type: header to denote the program result for
On 02Sep2018 14:29, Steven D'Aprano wrote:
On Sun, Sep 02, 2018 at 10:01:02AM +1000, Cameron Simpson wrote:
On 02Sep2018 00:31, Steven D'Aprano wrote:
>On Sat, Sep 01, 2018 at 11:41:42AM +, krishna chaitanya via Tutor
>wrote:
>>Below is my code, i am frequently hi
quot;su" and see if it matches your pattern.
And so on.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
it take to connect manually using ssh?
He's not using ssh - it is all local.
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
f he can mount a Solaris drive (NFS or SMB) he can just copy the files :-)
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
quot;export" from your
WIndows git (or some mirror elsewhere).
So: do you have rsync? Do you have ssh from your PC to the Solaris box?
Cheers,
Cameron Simpson
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
't have any way to extract semantics like
titles from a document.
The OP presumably has the specific output of a particular tool with this nice
well structured postscript, so he needs to write his/her own special parser.
Cheers,
Cameron Simpson
ameters. When you pass values to Python functions, you are passing
a reference, not a new copy. If a function modifies that reference's _content_,
as you do when you go "words.move(z)", you're modifying the original.
Try running this code:
my_words = ['bbb'
ter). For example:
with open(filename) as f:
for lineno, line in enumerate(f, 1):
if badness:
print("%s:%d: badness happened" % (filename, lineno), file=sys.stderr)
continue
... process good lines ...
Cheers,
Cameron Simpson
__
? Then the
tag might help you. Some other document format such as roff or LaTeX? A
terminal? If this is possible it will be entirely terminal dependent. A GUI of
some kind, such as Tk or Qt? You will need to consult its documentation for
its text widgets.
Cheers,
Cameron Simpson (
e are other tools for the same purpose).
In fact, tell us regardless. It aids debugging.
Cheers,
Cameron Simpson (formerly c...@zip.com.au)
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
sername")
password = input("Please enter your password")
Again, these lines should call raw_input(), not input().
def thank_you():
print("Thank you for signing up at our website!.")
You define this function but never call it.
elif choice == "q":
e that you get
an int back, which is easy to test for your other constraints (less than 1,
greater than 0). Now, because int(0 raises an exception for bad input you need
to phrase the test differently:
try:
value = int(digits)
except ValueError:
# invalid input, do something here
ather you use, is, I thought, just an editor. You also
need somewhere to run Python from. Those of use not using IDEs generally run
the programmes from a terminal. Personally I use iterm3 for my terminals, lots
of nice features.
Cheers,
Cameron Simpson (formerly c...@zip.com.au)
_
method will usually return None.
These modification methods _could_ return a value, but the general practice is
not to.
Cheers,
Cameron Simpson (formerly c...@zip.com.au)
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription
1 - 100 of 360 matches
Mail list logo