2012-03-08 5 views
-1

私はこのような機能を行うことができます。私は、このコードは、あなたがやりたいだろうguesスクリプトの一部に戻る?

def option(my_choose): #function named: make choose (choice) 
    if my_choose == 1: 
     while len(input_word) < 6: 
      input_word = input("type het gekozen 6 letterig woord in : ") #input for word 
      if len(input_word) < 6: 
      print ("to short, try again ") 
      else: 
      break 
    else: 
    .... 
+0

まず、何をする? Second mij input_wordはどこですか? – octopusgrabbus

+0

ユーザはオプション(オプション1)を選択し、6文字より長い単語を入力する必要があります。単語が6より大きくない場合は、それを戻して再度入力する必要があります。それは私が欲しいものです。 –

答えて

3

def again(): 
    again = input ("want to input the word again ? yes =1 no =2 ") 
    if again == 1: 
     func_input_word() 
    else: 
     return keuzemaken 
+0

tnx、あなたは私をたくさん助けます –

+0

もしPython 2.xを使っているなら、代わりにraw_inputを使ってください。 – ramtoo

+0

いいえ、それはpython 3スクリプトですが、もし私がもう少し助けが必要な場合は、あなたや他の何かを郵送することができますか? –

1

これはどのようにあなたがしようとしているものを

def func_input_word(): 
    input_word = "" 
    while len(input_word) < 6: 
     input_word = input("Input a 6 letter word: ") 
     if len(input_word) < 6: 
      print("Too small, try again!") 
     else: 
      return input_word 
def option(my_choose): #function named: make choose (choice) 
    if my_choose == 1: 
     input_word = func_input_word() 
    else: 
     .... 
関連する問題