+ Reply to Thread
Results 1 to 6 of 6

Thread: "ifs" and "elses" etc in python...help?!

  1. #1
    Newbie amateur is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    8

    "ifs" and "elses" etc in python...help?!

    ...
    Last edited by amateur; 07-08-2009 at 01:47 PM.

  2. #2
    Newbie amateur is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    8

    Re: "ifs" and "elses" etc in python...help?!

    ...
    Last edited by amateur; 07-08-2009 at 01:45 PM.

  3. #3
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,698
    Blog Entries
    57

    Re: "ifs" and "elses" etc in python...help?!

    You haven't listed the full code, the exact error messages, or anything else. It's hard to help without that kind of information.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #4
    Newbie ShadenSmith will become famous soon enough ShadenSmith's Avatar
    Join Date
    May 2009
    Location
    Kentucky - USA
    Age
    18
    Posts
    19

    Re: "ifs" and "elses" etc in python...help?!

    WingedPanther is correct, please post the source code and error message in order for us to be able to help. Please use the ["code"] tags (without the "").

  5. #5
    Learning Programmer CallBackGuy is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    29

    Re: "ifs" and "elses" etc in python...help?!

    Quote Originally Posted by amateur View Post
    ok...i've defined a, b and c.

    i want to make python give me the values for when a= b/c.

    i indented a bit, and then wrote "if a=b/c:"

    after entering taht line, i got an error type message on my screen.

    so can you tell me exactly what to type after defining a, b and c? was getting ready to try and "else, if" type thing, where i'd say, if a=b/c then print a, b and c. else print nothing.............HHHEEEELLLLPPP!!!!
    You simply want to check if a is equivalent to b and c?
    Code:
    a, b, c = 1, 2, 2
    
    while 1:
    	if a == b and c:
    	     print "a equals %s which is the same as b(%s) and c(%s)"%(a, b, c)
    	     break
    	else:
    	     print "a equals %s which is not the same as b(%s) and c(%s)"%(a, b, c)
    	a = 2

  6. #6
    Newbie Butters is an unknown quantity at this point
    Join Date
    Jul 2009
    Location
    York, UK
    Posts
    1

    Re: "ifs" and "elses" etc in python...help?!

    You want the line "if a == b/c:"
    a=b/c is an assignment.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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