Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Need help with a python code

  1. #11
    Join Date
    Aug 2009
    Location
    Tampa Fl
    Beans
    15
    Distro
    Ubuntu 6.10 Edgy

    Re: Need help with a python code

    This is what the teacher had us do in class so I'm going by what He had done to the code
    Ps don't understand the white space thing.

  2. #12
    Join Date
    Aug 2009
    Location
    Tampa Fl
    Beans
    15
    Distro
    Ubuntu 6.10 Edgy

    Re: Need help with a python code

    This is the code the teacher had and I don't know if He was able to get it to run
    P.S. not sure what the white space thing is about please explain TY.

  3. #13
    Join Date
    Dec 2007
    Location
    The last place I look
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Need help with a python code

    Quote Originally Posted by benj1 View Post
    first off when posting code put it in code tags (the # symbol) makes it easier to read, and doesnt mess up python either (preserves white space)

    second you dont need 2 'while endOrder == 'no':' loops
    it looks like a nested loop. prompt for type of food, then prompt for number of items repeatedly.

    OP:
    please reply, and click the '#' icon on the message window. then between the code tags, paste the code. it will look like my initial reply, if you preview it, with the code in a white box.

  4. #14
    Join Date
    Dec 2007
    Location
    The last place I look
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Need help with a python code

    http://www.clarejohn.com/python1/python1.html
    check out chapter for for flow control and whitespace.

  5. #15
    Join Date
    Oct 2008
    Beans
    561

    Re: Need help with a python code

    Quote Originally Posted by leedrew View Post
    This is the code the teacher had and I don't know if He was able to get it to run
    P.S. not sure what the white space thing is about please explain TY.
    whitespace is important in python

    Code:
    def foo (bar):
    print bar
    wont do the same as
    Code:
    def foo(bar):
        print bar
    its basically like brackets in c.
    without whitespace your program wont work, thats your problem.

    @doas777
    the first loop just sets all the variables to 0, and that loop will finish at the same time as the second loop, its not wrong just a bit redundant.
    Check out my little app. Tnote

  6. #16
    Join Date
    Oct 2008
    Beans
    561

    Re: Need help with a python code

    Quote Originally Posted by doas777 View Post
    http://www.clarejohn.com/python1/python1.html
    check out chapter for for flow control and whitespace.
    your link is broken


    http://www.greenteapress.com/thinkpy...inkpython.html

    this is quite a good intro too
    Check out my little app. Tnote

  7. #17
    Join Date
    Aug 2009
    Location
    Tampa Fl
    Beans
    15
    Distro
    Ubuntu 6.10 Edgy

    Re: Need help with a python code

    that link is broken also I tried them both

  8. #18
    Join Date
    Dec 2007
    Location
    The last place I look
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Need help with a python code

    interesting. they both work fine for me. weird.

    anyway, just google 'python tutorial flow control' and whitespace will be explained on whatever tutorial you land on. if it isn't, then it's a poor tutorial.

  9. #19
    Join Date
    Aug 2009
    Location
    Tampa Fl
    Beans
    15
    Distro
    Ubuntu 6.10 Edgy

    Re: Need help with a python code

    This is the third time I've tried to reply back Am hoping it goes thru this time Thanks for the help Am looking intoo the thinkpython again thanks.
    I'm really green when it comes to code writting as you can tell.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •