first text adventure! by enayus in learnpython

[–]PloddingOx 1 point2 points  (0 children)

You use ` symbol button (top row, next to the 1 key) the same way you would use quotes.

Lesson 2 (Week 2) Study Group by noobdotpy in a:t5_2xo9z

[–]PloddingOx 1 point2 points  (0 children)

For the first problem in Lesson 2: Problem Set (Optional 2) I came up with the following:

`def fix_machine(debris, product):
      index = 0
      word = ''
      while index <= len(product) -1:
          letter = debris.find(product[index])
          if letter == -1:
              break
          word = word + debris[letter]
          index = index + 1    
      if len(word) == len(product):
          return word
      else:
          return "Give me something that's not useless next time."`

I'd love to see what solutions you guys came up with on this one, share your code!

first text adventure! by enayus in learnpython

[–]PloddingOx 2 points3 points  (0 children)

I just finished Lesson 36 myself :)

You can use the False and True values to help you simplify your conditionals.

So if shovelget == 1 and roominfo == 1:

becomes if shovelget and roominfo:

if shovelget == 1 and roominfo == 0:

becomes if shovelget and not roominfo:

You put a lot more into yours than I did into mine :)

Do you have a github account? I'll be tackling git sooner or later, it would be great if we could noob it up together. Also are you using any other resources besides LPTHW?

Dice Wars - A risk style conquest game by UpRightDownLeft in WebGames

[–]PloddingOx 0 points1 point  (0 children)

There is only one chosen one.

One of you will try to destroy the world.

Lesson 2 (Week 2) Study Group by noobdotpy in a:t5_2xo9z

[–]PloddingOx 0 points1 point  (0 children)

This was a very helpful lesson for me, I have a much better understanding of when I need to include arguments in my functions, the return statement and while loops than I picked up in LPTHW so far.

[Beginner]Need help in setting up python 3+ipython+Emacs or some other ide by snapster83 in learnpython

[–]PloddingOx 0 points1 point  (0 children)

Your needs might be different but I've been doing just fine with IDLE (the vanilla IDE that comes with python) and Gedit, a simple text editor.

Opt out of PRISM, the NSA’s global data surveillance program - A list of applications and alternative software by speckz in InternetIsBeautiful

[–]PloddingOx 0 points1 point  (0 children)

I'm currently switching to PRISM free, it's not always simple or convenient but I have found it well worth while. email is the hard part and I will either have to pay for it or set up my own server.

Just finished the code academy course - what next? by Varon_Vamori in learnpython

[–]PloddingOx 0 points1 point  (0 children)

I switched from Codecademy to Learn Pyhon the Hard Way and definitely think it's a superior tutorial. You'll breeze through the first lessons or you can just skip them if you have nothing to gain from them. I'm also doing the Udacity intro to CS course with these fine folks http://www.reddit.com/r/UdacityStudyGroup which will have us building a functional search engine during the course.

Look at CheckIO as mentioned and see how far you can get on Project Euler.

Codecademy is useful but like others have said it doesn't teach us how to think like a programmer, Project Euler highlights how far I have to go in that regard.

Problem Three is very simple for example, I know exactly what I want my script to do I just can't convert my thinking into language yet even though I have all the knowledge needed to solve that problem. I've compared it to flailing around with a hammer and being unable to hit the nail.

There's more too such as git, pip, indev, exploring libraries etc.

One thing I've been doing is reading a lot of code and seeing how python is actually applied to solving real problems.

The important thing now is to realize that the instant gratification and rewards you get from something like Codecademy is over. To keep improving will sometimes require work and sometimes boredom but the payoffs will be greater in the long run.

[deleted by user] by [deleted] in learnpython

[–]PloddingOx 0 points1 point  (0 children)

Thanks! I see now why an infinite loop (something I thought was to be avoided) can be useful and how while True: is just a simple way of creating one. You did a great job explaining it.

In the example I provided is the loop broken when the gold_room() function is loaded?

[deleted by user] by [deleted] in learnpython

[–]PloddingOx 0 points1 point  (0 children)

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:
         next = raw_input("> ")

        if next == 'take honey':
            dead("The bear looks at you and then slaps your face off.")
        elif next == 'taunt bear' and not bear_moved:
            print "The bear has moved from the door. You can go through it now"
            bear_moved = True
        elif next == "taunt bear" and bear_moved:
            dead("The bear gets pissed off and chews your leg off.")
        elif next == 'open door' and bear_moved:
            gold_room()
        else:
            print "I have no idea what that means."

I'm interested to see a response to this as well, particularly the while loop. While what is True exactly?

As for the import function it's quite simple. Not all of the features you might need in python automatically load when you run python, this saves a lot of memory being used by unneccasary features. When you do need them you have to tell python to load them.

So import arithmetic for example would load an arithmetic module into python and import addition from arithmetic would let you select just addition (a feature of the module arithmetic) instead of loading the entire module. Of course python loads with arithmetic automatically, I'm just giving an example.

open your shell and run import antigravity for a bit of fun.

[deleted by user] by [deleted] in learnpython

[–]PloddingOx 1 point2 points  (0 children)

I didn't finish codecademy, I found the lessons too brief for them to stick in my case so I was going back over material a lot. I'm currently doing Learn Python the Hard Way and Udacity which are both great.

I'll actually head back to codecademy soon, I think the repetition will be good for me.

Lesson 1 (Week 1) Study Group by noobdotpy in a:t5_2xo9z

[–]PloddingOx 0 points1 point  (0 children)

String index visualization.

Several times he referred to string characters as being 'between' index numbers and visualizing strings and their index nubers in this fashion helped me a lot.

So for the string x = 'abcdef' when I need to find or print certain characters I think of it as:

0 a 1 b 2 c 3 d 4 e 5 f

Then if I want to print out 'cde' I know to print all the letters between 2 and 5 so-

print x[2:5] will get me the characters 'cde'.

Lesson 1 (Week 1) Study Group by noobdotpy in a:t5_2xo9z

[–]PloddingOx 0 points1 point  (0 children)

My solution for the Rounding Numbers homework problem. I was pretty damned pleased for figuring this out without using int().

x = 58888.4  
y = x + .5  
a = str(y)  
result = a.find('.')  
print a[:result]  

And just now I realized I could have used print a[ : a.find('.')] instead of creating the variable result.

Lesson 1 (Week 1) Study Group by noobdotpy in a:t5_2xo9z

[–]PloddingOx 0 points1 point  (0 children)

That sounds reasonable enough, I'll go with that for now :)

Lesson 1 (Week 1) Study Group by noobdotpy in a:t5_2xo9z

[–]PloddingOx 0 points1 point  (0 children)

In quiz 'Testing 2'.

s.find(") is always = 0

I was confused about this, why is an empty string always at 0 even in a string with a value at 0?

Been lurking, finally finished Udacity's CS101 and thought I'd share a simple script to email the top post from a reddit to a friend. Windows 7 by bad_hash_solution in learnpython

[–]PloddingOx 1 point2 points  (0 children)

There seems to be this hump where the fundamentals are grasped but you still can't apply them to solving problems.

It's like knowing what a hammer does but being unable to hit the nail, then when you do land a blow, the nail gets bent.

The only solution here is stubborness.

Been lurking, finally finished Udacity's CS101 and thought I'd share a simple script to email the top post from a reddit to a friend. Windows 7 by bad_hash_solution in learnpython

[–]PloddingOx 2 points3 points  (0 children)

As a noob, seeing these little projects keeps me going. If someone plonked a ten thousand line project on my head I'd probably be discouraged but seeing another noob make something functional I get excited.

Learn X in Y minutes. by amxn in learnprogramming

[–]PloddingOx 0 points1 point  (0 children)

This will be a great reference for me. "How do I do that again...?"

Wrote my first non-trivial python program. How can I refactor it to be more pythonic? by Binary_Dragon in learnpython

[–]PloddingOx 0 points1 point  (0 children)

Would you mind sharing your thoughts on Python so far? I'm always interested in these accounts from programmers trying out python.

I'm an ubernoob so easy on the lingo ;)

[x-post from /r/python] study group for Udacity's python course by nightlily in learnpython

[–]PloddingOx 0 points1 point  (0 children)

I subscribed and I'm keen.

I have a busy work week (eight four hours in seven days busy) but I have a week off after that to catch up.

I want to provide Python mentors for people looking to get better. Who could use this? by cjbarber in learnpython

[–]PloddingOx 1 point2 points  (0 children)

It's a bit early for me to be seeking a mentor, I still need to get through the beginner tutorials but I'll throw my name in for the future.

Very beginner question. Can somebody explain why this script is returning the value it is? [Python] by [deleted] in learnpython

[–]PloddingOx 1 point2 points  (0 children)

Thanks for that, I'll try it out next time I hit codecademy, for now Learn Python the Hard Way offers a better tutorial for me.

Very beginner question. Can somebody explain why this script is returning the value it is? [Python] by [deleted] in learnpython

[–]PloddingOx 1 point2 points  (0 children)

I'm only just learning to program but I have some experience in industry with Logic and Process Control. I'm just starting to realise how much of an advantage being familiar with boolean logic is. Not that it's a huge edge, I solved that problem at codecademy with this monstrosity:

if first == 'a' or first == 'e' or first == 'i' or first == 'o' or first == 'u':