[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/python/ - Python Lovers

Hack and develop

Catalog

Name
Email
Subject
Comment *
File *
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 1 per post.


File: 1440981918755.jpg (110.11 KB, 638x826, 319:413, learn-python-the-hard-way-….jpg)

 No.41[Reply]

Uber Noobfag here, please help…

Here is the full code :- http://learnpythonthehardway.org/book/ex35.html

So this is the part of the code I am having trouble with:-

"""

def bear_room():

print "There is a bear here."

print "The bear has a bunch of honey."

print "The fat bear is in front of another door."

print "How are you going to move the bear?"

bear_moved = False

while True:

choice = raw_input("> ")

if choice == "take honey":

dead("The bear looks at you then slaps your face off.")

elif choice == "taunt bear" and not bear_moved:

print "The bear has moved from the door. You can go through it now."

bear_moved = True

elif choice == "taunt bear" and bear_moved:

dead("The bear gets pissed off and chews your leg off.")

elif choice == "open door" and bear_moved:

gold_room()

else:

print "I got no idea what that means."

"""

When I type "taunt bear", nothing happens… Why??

Wouldn't "and not" set bear_moved to True?

Any help would be greatly appreciated…

TLDR : Just explain the code snippet to me in English

 No.42

>>41

> elif choice == "taunt bear" and bear_moved

bear_moved itself is just True/False, that won't do anything and I think it's confusing it somehow. I'm pretty new to Python but you should give it a shot. Though I'm sure you've figured it out by now.

>7 months ago




File: 1440671170877.png (15.25 KB, 643x505, 643:505, pycap001.png)

 No.38[Reply]

PROGRESS THREAD. NO EXCUSES.

I MADE A SLIDING PUZZLE GAME IN PYTHON

I FINALLY FUCKING FEEL COMFORTABLE ENOUGH TO FUCK WITH THE CODE NOW

HERE'S A GODDAMN SLIDING PUZZLE, THE BUTTONS WORK AS INTENDED

>I also started the Codeacademy course on command line because I'm on linux

 No.39

File: 1440671503400.png (58.82 KB, 643x506, 643:506, pycap002.png)

HERE'S ANOTHER PICTURE OF ME JUST GOING ABSOLUTELY BATSHIT

IT STILL ANIMATES


 No.40

File: 1440671626987.png (19.94 KB, 1288x745, 1288:745, pycap003.png)

>HELP




File: 1434092595861.png (1.13 KB, 58x21, 58:21, car.png)

 No.1[Reply]

No one is here, but I thought I'd make a post anyway.

I'm learning python at turtle speed, but making decent progress.

I'm learning with Pygame (I'm a visual learner) alongside CodeAcademy's guides.

>pic related, it's a shitty car I made to help me visualize what the fuck I'm doing

>spend 5 minutes writing code I understand

>spend the next 55 minutes trying to figure out what the fuck I just did

>can't remember proper syntax for shit

>code is 80% notes

>maximum recursion depth exceeded

Any tips for someone relatively new to programming?

Python general

27 posts and 16 image replies omitted. Click reply to view.

 No.33

File: 1438912213252.png (13.77 KB, 531x211, 531:211, cafinished.png)

I finally finished the Codeacademy Python course. I wish there were more resources similar to theirs for python plugins.

>what the fuck is bitwise operators

>0b010mybrain10001melting010


 No.34

File: 1438912489175.png (9.58 KB, 476x109, 476:109, syn3.png)

I spent a few hours trying to debug code I had copied (and modified very minor) and learned a valuable lesson about the interpreter. Debugging is not so difficult and for the most part, after completing the Python course, is pretty intuitive…sometimes.


 No.35

File: 1438912629907.png (2.18 KB, 358x17, 358:17, syn4.png)

The code I had written was missing a slash in the original call for os.getcwd() and for some reason I assumed it was correct from the outset.

Lesson learned. I had to go through quite a bit of minor editing because of this.

I'm slowly learning the importance of "debugging on the fly"


 No.36

File: 1438912736019.png (5.35 KB, 329x74, 329:74, syn2.png)

The image refers to what I said in the last post.

This project I am putting on the backburner. I feel more well-versed in Python after finishing the codeacademy course,

but I have a heightened interest in Pygame purely as a hobby learning experience (and, because I grew up playing vidya)


 No.37

File: 1438913244890.png (64.61 KB, 655x452, 655:452, woohoo.png)

I am now programming daily, this is a screenshot of when I read about generating random strings for passwords.




File: 1434867218447.png (605.78 KB, 700x700, 1:1, 1430459130390.png)

 No.15[Reply]

15 GET claimed by the niggers over at

>>>/fuckwit/

y'all kikes better go over there and post scat or else



File: 1434147956363.jpg (19.05 KB, 640x480, 4:3, deadlines.jpg)

 No.2[Reply]

Any renpy devs around here?



Delete Post [ ]
[]
Previous [1] Next | Catalog
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]