Re: [Tutor] The game of nim in python

2016-04-22 Thread Danny Yoo
On Fri, Apr 22, 2016 at 5:45 AM, Henderson, Kevin (GE Aviation, US) wrote: > Python to Jython. > > Can you help me with a Jython code for the Nim game? If you can say more about what you're like help with, we can tailor advice toward what you want. I'll treat this as a quick-and-dirty design rev

Re: [Tutor] The game of nim in python

2016-04-22 Thread Michael Selik
What's the problem you're trying to solve? Did you get an error? Here's a quick revision. There's probably a more elegant way, but this seems to work. #/usr/bin/env python from __future__ import print_function import random try: input = raw_input except NameError:

Re: [Tutor] using a for loop in another method

2016-04-22 Thread Michael Selik
On Fri, Apr 22, 2016 at 1:57 PM Rene.Castillo wrote: > expected output- > reverse_words("This is an example!") # returns "sihT si na !elpmaxe" > > def reverse_words(strng): > strng = strng[::-1].split(' ') > strng.reverse() > return ' '.join(strng) > Let's walk through each step that you

Re: [Tutor] The game of nim in python

2016-04-22 Thread Alan Gauld via Tutor
On 22/04/16 13:45, Henderson, Kevin (GE Aviation, US) wrote: > Python to Jython. > > Can you help me with a Jython code for the Nim game? > There shouldn't be much difference between a Jython or Python implementation - unless you are building a GUI of course! > Removing 1-4 sticks out of 13, la

Re: [Tutor] using a for loop in another method

2016-04-22 Thread Tim Golden
On 22/04/2016 17:08, Rene.Castillo wrote: Hi, this is my first post on this mailing list- I wanted to ask about this type of execution in python, expected output- reverse_words("This is an example!") # returns "sihT si na !elpmaxe" below is my execution, followed by another persons execution

Re: [Tutor] The game of nim in python

2016-04-22 Thread Henderson, Kevin (GE Aviation, US)
Python to Jython. Can you help me with a Jython code for the Nim game? Removing 1-4 sticks out of 13, last player who picks up the last stick wins Player 1 vs player2(Computer) player1=str(input("Enter your name. ")) player2="Computer" howMany=0 gameover=False strawsNumber=random.randint(10,20)

[Tutor] using a for loop in another method

2016-04-22 Thread Rene.Castillo
Hi, this is my first post on this mailing list- I wanted to ask about this type of execution in python, expected output- reverse_words("This is an example!") # returns "sihT si na !elpmaxe" below is my execution, followed by another persons execution, which i dont completely understand. def r