Skip to content

Conversation

@Adam-Hoelscher
Copy link

added shebang
replaced C-style looping with pythonic looping
put in version checking so it runs in python3 also
added doc strings
poked fun at Matt, even though I'm actually really jealous: I need more friends who want to sit around a pub and write python with me on random nights

added shebang
replaced C-style looping with pythonic looping
put in version checking so it runs in python3 also
added doc strings
poked fun at Matt, even though I'm actually really jealous: I need more friends who want to sit around a pub and write python with me on random nights
@septatrix
Copy link

You could also use randint instead of randrange and save a +1 offset.

Also I haven't tried but I think you need to import the print function from future if you want to use it in Python 2🤔

@Adam-Hoelscher
Copy link
Author

Also I haven't tried but I think you need to import the print function from future if you want to use it in Python 2

Matt's original code was written for Python2; it's why he manually built a tab-delimited string for printing

@AustinTSchaffer
Copy link

AustinTSchaffer commented Sep 18, 2019

@Adam-Hoelscher, @septatrix is saying that you should add a from __future__ import print_function to the imports in order to unambiguously support Python 3, as well as Matt's development setup, which uses Python 2.

@septatrix, just tested it, the print statement at the bottom works on Python 2.

@Adam-Hoelscher
Copy link
Author

Also I haven't tried but I think you need to import the print function from future if you want to use it in Python 2🤔

This doesn't sound like a request for Python 3 support to me

@septatrix
Copy link

Yes you are right but I thought you had to include said statement to use the print('') function instead of the print '' statement in Python 2 but according to the docs and Auston it is optional from version 2.6.0a2 and onwards so my bad :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants