Hi, there! I'm pretty new to the programing world and I have a question.

How can I write this code so it returns to surv1.set_sex = raw_input? after the "not in sex statement"?

It's really confusing maybe I should try and write it in someother way?

I don't quite understand the while: try: catch thing... And no of my fellow students can help me around this clock and hour.

I'm counting on you. The internet such a wonderful place! :)


def sex():
    surv1.set_sex = raw_input("Välj kön: ")
    sex = ["m","k","b"]
    while surv1.set_sex not in sex:
        print "\nAnge ett giltigt värde m (man) / k (kvinna) / b (både man och kvinna) "

Could you rephrase that? I'm not sure if this is what you're after, but:

while True:
    surv1.set_sex = raw_input("What's your gender?")
    if surv1.set_sex in ["m","f","n"]
        print "Please answer m (male), f (female), or n (neither)."

Thnx alot, you were spot on I will try it! Sorry that I didn't rephrase it to english (original is in swedish)! I'm very grateful! I will try it at once!