Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Learn Python the Hard Way

Name: David Heinemeier Hansson 2012-06-30 22:20

I'm trying to make a text game in python and I need some advice-- please.

I'm trying to make it where you must choose between 5 escape pods, however space pod #s 1-4 have been sabotaged and if you take them you die:

good_pod = int(5)
bad_pods = int(1,4)
guess = raw_input("[pod #]")
if int(guess) == "bad_pod":
...

However the terminal says  "can't convert non-string with explicit base" for the bad_pods. And I tried using int((1),(2),(3),(4)) but I can only use it for two.

TL;DR:

What do I use to include integers 1-4?

Name: Anonymous 2012-06-30 22:24

Why the fuck is it in quotes

Name: Anonymous 2012-06-30 22:37


good_pod = 5
bad_pods = range(1,5)
guess = int(raw_input('[pod #]'))
if guess in bad_pods:
    # fuck off

Name: Anonymous 2012-07-01 5:33

Learn Hard the Python Way

Name: Anonymous 2012-07-01 6:17

good_pod = int(5)

Why not just...

good_pod = 5

Name: Anonymous 2012-07-01 10:53

it gets my python hard

Name: Anonymous 2012-07-01 12:37

Learn Python the Hard Way is only good if you're a masochist.
Use Think Python instead.

Name: bampu pantsu 2012-07-06 4:51

bampu pantsu

Don't change these.
Name: Email:
Entire Thread Thread List