2016-08-29 6 views
0

私の質問:私はこれをコードクローバーで動作させることができますが、私のIDEでは使用できません。助けてください!なぜこのコードは実際の環境では機能しませんか? 'normal'は定義されていません(新しいコーダー)

Uinput = input("first morph") 
Uinput2 = input("second morph") 

#this section of code accepts normal or recessive to 
#calculate if you will get hets. If hets, clarify morph in separate function 
#input to compare are words 

def normal_recessive(): 
if Uinput == ("normal") and Uinput2 == ("normal"): 
    print("your results will be all wildtypes") 
elif Uinput == ("normal") and Uinput2 == ("recessive"): 
    print("Your results will be heterozygous aka hets") 
elif Uinput == ("recessive") and Uinput2 == ("normal"): 
    print("Your results will be heterozygous aka hets") 
elif Uinput == ("recessive") and Uinput2 == ("recessive"): 
    print("Your results will be all recessive") 
else: 
    print("input error, please input recessive or normal for morph type") 
    print("please check your spelling and try again") 

normal_recessive() 

答えて

0

CodeSkulptorは、Python 3を実行しているし、あなたのIDEが実行されているようですinput関数は、2つのニシキヘビの間で異なる動作をPythonの2に聞こえます。

Python 3を使用するようにIDEを構成すると、コードが機能するはずです。あなたがPythonの2の代わりに、Pythonの3を使用する必要がある場合は、raw_inputであなたのコードでinputを置き換えるよう

はまた、Pythonの2 raw_input関数は、Pythonの3 input機能が何を行います。

+0

これは意味があります。どうもありがとうございます!!! – DerTier

+0

er、私は何かの理由で私のPC上で実行されているpython 3xに関する問題を抱えていることを忘れていました.pi-ms-win-crt-runtime- | 1-1-0.dllをダウンロードしたり更新したりすることはできません私は私を助けるために、あるいは私が何をしようとやるのかを援助する。私は現在2.7を稼動しています.3x X_Xに何か提案がありますか? 私はウィンドウを更新しようとしましたが、ファイルをオンラインでダウンロードしようとしましたが、Visual Studio C++のボーイフレンドのコピーをコピーしようとしました。おそらくファイルがどこから来ているのでしょうか... – DerTier

+0

Python 2 'input'の代わりに' raw_input'を使うことができます。私の答えに追加した新しい段落を参照してください。 Python 2とPython 3の間にはわずかな違いがありますが、特に扱いにくいものはありません。 –

関連する問題