Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-21 Thread Srihari Vijayaraghavan
On 21 August 2015 at 02:57, Alan Gauld wrote: > On 20/08/15 09:51, Srihari Vijayaraghavan wrote: > >> In general I agree, but this is what the os.walk() document states: >> "... When topdown is True, the caller can modify the dirnames list >> in-place (perhaps using del or slice assignment)..." >

Re: [Tutor] problem with code

2015-08-21 Thread Timo
Op 20-08-15 om 16:49 schreef Aravind Jaya: time = input("How long on average do you spend on the computer per day?") if time <= 2: print "Message1" else: print "Message2" This will raise 2 errors: - time will be a string. So time <= 2 is invalid. - print is a function. Updated co

Re: [Tutor] problem with code

2015-08-21 Thread Mark Lawrence
On 20/08/2015 15:49, Aravind Jaya wrote: time = input("How long on average do you spend on the computer per day?") if time <= 2: print "Message1" else: print "Message2" If you insist on top posting you could at least get your response correct. The comparison will fail in Python 3.3

Re: [Tutor] Do not understand why test is running.

2015-08-21 Thread Alex Kleider
On 2015-08-20 23:16, Peter Otten wrote: Yea, breaking things is an art form ;) $ python3 -m unittest -h usage: python3 -m unittest [-h] [-v] [-q] [-f] [-c] [-b] [tests [tests ...]] . For test discovery all test modules must be importable from the top level directory of the proje

Re: [Tutor] Do not understand why test is running.

2015-08-21 Thread boB Stepp
On Fri, Aug 21, 2015 at 1:16 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: > >> On Thu, Aug 20, 2015 at 10:13 PM, Steven D'Aprano >> wrote: >>> On Thu, Aug 20, 2015 at 09:01:50PM -0500, boB Stepp wrote: >>> >>> import unittest # import modules to be tested: impor

Re: [Tutor] Do not understand why test is running.

2015-08-21 Thread Laura Creighton
In a message of Fri, 21 Aug 2015 06:26:11 -0700, Alex Kleider writes: >On 2015-08-20 23:16, Peter Otten wrote: > > >> Yea, breaking things is an art form ;) > > >> $ python3 -m unittest -h >> usage: python3 -m unittest [-h] [-v] [-q] [-f] [-c] [-b] [tests [tests >> ...]] >> >. >> >> For test

[Tutor] Can someone explain this to me please

2015-08-21 Thread Jon Paris
This code: import sys x = sys.maxsize print ("Max size is: ", x) y = (x + 1) print ("y is", type(y), "with a value of", y) Produces this result: Max size is: 9223372036854775807 y is with a value of 9223372036854775808 I was expecting it to error out but instead it produces a value greeter th

Re: [Tutor] Can someone explain this to me please

2015-08-21 Thread Laura Creighton
In a message of Fri, 21 Aug 2015 14:04:18 -0400, Jon Paris writes: >This code: > >import sys >x = sys.maxsize >print ("Max size is: ", x) >y = (x + 1) >print ("y is", type(y), "with a value of", y) > >Produces this result: > >Max size is: 9223372036854775807 >y is with a value of 9223372036854775

Re: [Tutor] Can someone explain this to me please

2015-08-21 Thread Alan Gauld
On 21/08/15 19:04, Jon Paris wrote: Max size is: 9223372036854775807 y is with a value of 9223372036854775808 I was expecting it to error out The documentation says: --- sys.maxsize An integer giving the maximum value a variable of type Py_ssize_t can take. It’s usually

Re: [Tutor] Complications Take Two (Long) Frustrations.

2015-08-21 Thread Roel Schroeven
Joseph Gulizia schreef op 2015-08-20 05:12: Assume that the grader defines two variables A and B for you. Write a program which prints out the value min(A, B) However, there is a catch: your program is not allowed to use the min function. Instead, use max in a clever way to simulate min. ---

Re: [Tutor] Complications Take Two (Long) Frustrations.

2015-08-21 Thread Joel Goldstick
On Fri, Aug 21, 2015 at 4:58 PM, Roel Schroeven wrote: > Joseph Gulizia schreef op 2015-08-20 05:12: >> >> Assume that the grader defines two variables A and B for you. Write a >> program which prints out the value >> min(A, B) >> >> However, there is a catch: your program is not allowed to use th

Re: [Tutor] Complications Take Two (Long) Frustrations.

2015-08-21 Thread Roel Schroeven
Joel Goldstick schreef op 2015-08-21 23:22: so: print -max(-A, -B) That's what I mean, yes. I haven't tried it, but I don't see why it wouldn't work. Regards, Roel -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac A