On Sat, Aug 23, 2014 at 9:37 PM, Alan Gauld wrote:
> While I wouldn't say its the best environment I don't think its
> fair to say Windows is "a bad environment for Python". Any
> experienced Windows programmer will find it much easier to use Python on
> Windows than to learn a whole new OS and de
name = input("Enter your name: ")
age = int(input("Enter your age: "))
gb = input("Are you a boy or a girl? ")
op = input("How are you feeling today? ")
if (age in (1,2,3,4,5,6,7,8,9,10,11,12)):
print (name,"you are a little",gb,"that is feeling",op,"today.")
if (age in (13,14,15,16
On 24/08/14 15:11, Mimi Ou Yang wrote:
age = int(input("Enter your age: "))
gb = input("Are you a boy or a girl? ")
input() returns a string so the values here
should be 'boy' or 'girl' - Notice the quote signs.
op = input("How are you feeling today? ")
if (age in (1,2,3,4,5,6,7,8,9,10,11,1
On 8/23/2014 7:16 AM, Mimi Ou Yang wrote:
age = input("K")
age = int(age)
if (age == 1) or (age == 2) or (age == 3) or (age == 4):
print ("LOL")
else:
print ("K")
Is there a shorter way to do this program???
print ('LOL','K')[int(input("k"))>4]
___
forwarding to the group.
Please use ReplyAll when responding to the list.
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
>
> From: D.V.N.Sarma డి.వి.ఎన్.శర్మ
>To: Alan Gauld
>Sent: Sun
Given
$ cat compare.py
#!/usr/bin/env python3
import os
import sys
def get_args():
try:
args = sys.argv[1:]
except IndexError:
return
return [arg for arg in args if os.path.isfile(arg)]
if __name__ == "__main__":
print(get_args())
How can one unittest get_args()?
On Sun, Aug 24, 2014 at 05:23:35PM -0700, Alex Kleider wrote:
> Given
> $ cat compare.py
> #!/usr/bin/env python3
> import os
> import sys
>
> def get_args():
> try:
> args = sys.argv[1:]
> except IndexError:
> return
> return [arg for arg in args if os.path.isfile(arg)
Thank you very much, Steven. This is just the help I needed.
Forgive me for causing confusion- I pared down my code for presentation
but not enough and also left the names which now out of context, don't
make sense. In line explanations provided below although it would
probably
be of little i
>>> Is there a way that I can provide the file name command line parameters
>>> to compare.py so that its get_args function can be tested?
>>
>> sys.argv is writeable, or better still, provide get_args() an optional
>> argument to use instead of sys.argv.o
>
>
> I don't understand what you mean by