[Tutor] help me

hind fathallah hind_fathallah at yahoo.com
Mon Mar 10 23:25:44 CET 2014


hi I need your help plz with this cods ( I want u to  tell wht cod I miss to stop the while loop whene I get 3 stars) 
rm = []
stars = 0
##if stars == "3":
##    print " You win"
##else:
##    print "hh"
def ask_yes_no(question):
    """Ask a yes or no question."""
    answer = None
  
    while answer not in ("y", "n"): 
        answer = raw_input(question).lower()
    return answer
def congrate_winner(stars = "3"):
    print "congradulation you have.", stars, " stars you won!\n"
    
    return stars

##def stars():
##    #stars = 0
##    global stars
##    stars = stars + 1
##    print "stars:", stars, "\n"
##  
##    if stars == "3":
##        print "congadulation you win"
##    else:
##        print "Go to the next room"
##    return stars
def rest_room():
    restroom = ["shower", "sink"]
    print restroom
    global stars
    ans = ask_yes_no("It does star ther?: ")
    print "This is the value of ans.", ans
    if ans == "y":
        
        
        print "\nOK"
        
        stars = stars + 1
        print "Stars:", stars, "\n\n"
       

    else:
        print "hmm go to another room."
        print "Stars:", stars, "\n\n"
    return ans, restroom
def living_room():
    livingroom = ["uyyg", "hfgfd", "star"]
    print livingroom
    global stars
    ans = ask_yes_no("It does star ther?: ")
    print "Your answe is.", ans
    if ans == "y":
         
        print "\nOK"
        stars = stars + 1
        print "Stars:", stars, "\n\n"
        

    else:
        print "hmm go to another room."
        print "Stars:", stars, "\n\n"
      
    return ans, livingroom
def bed_room():
    bedroom = ["iuyg", "star"]
    
    print bedroom
    global stars
    ans = ask_yes_no("It does star ther?: ")
    print "Your answe is.", ans
    if ans == "y":
         
        print "\nOK"
        stars = stars + 1
        print "Stars:", stars, "\n\n"
    else:
        print "hmm go to another room."
        print "Stars:", stars, "\n\n"
    return ans, bedroom
def Kichen():
    kichen = ["star", "jyhffd"]
    global stars 
    print kichen
    ans = ask_yes_no("It does star ther?: ")
    print "Your answe is.", ans
    if ans == "y":
         
        print "\nOK"
        stars = stars + 1
        print "Stars:", stars, "\n\n"
    else:
        print "hmm go to another room."
        print "Stars:", stars, "\n\n"
    return ans, kichen
    
def main():
   print "Wlecome to my house."
   rm = None
 
   
   while rm != stars:
        print\
        """
        0 - Northe
        1 - South
        2 - East
        3 - Weast
        """
        rm = raw_input("What room you want to go?: ")
      
    
        if rm == "0":
            rest_room()
        elif rm == "1":
            living_room()
        elif rm == "2":
            bed_room()
        elif rm == "3":
           Kichen()
     
        
##if stars == "3":
##    congrate_winner()    
        
main()

raw_input("\nPress the enter key to exit.") 




On Saturday, February 1, 2014 6:40 PM, hind fathallah <hind_fathallah at yahoo.com> wrote:
 
thank you so much because I got it :) 



On Saturday, February 1, 2014 1:28 PM, Danny Yoo <dyoo at hashcollision.org> wrote:
 
On Fri, Jan 31, 2014 at 8:55 PM, hind fathallah

<hind_fathallah at yahoo.com> wrote:
> hi can you answer this question for me plz

[question omitted]

Many of us probably could answer this.

But this is not a homework-answering mailing list.  The problem itself
is not interesting to us.  What is interesting is why the problem is
giving you trouble.  We'd rather focus on where you are having
difficulty: we'd rather help *you*.

Tell us what you've tried, where you're getting stuck, what other
kinds of problems you've done that are similar to this one.  That is,
show us what general problem solving strategies you're using now.
Maybe some of those strategies are not working for you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140310/f6f8ccfd/attachment-0001.html>


More information about the Tutor mailing list