2017-05-04 52 views
0

我正在做一個有不同難度的小測驗,當我做簡單的部分時我的if語句總是打印不正確,即使正確的答案 - 我仍然對python不熟悉它可能是一件非常簡單的事情解決 我怎麼能知道,如果這是一個重複的,如果我不知道什麼是錯 這裏是我的代碼不等於聲明,不能正常工作

def easy(): 
    score = 0 
    print("Welcome to the easy section!") 
    print("****************************") 
    print("Random Access Memory(1)") 
    print("Radical Amazonian Mandem(2)") 

    qe1 = input("What does RAM stand for?: ") 

    if qe1 == 1: 
     score = score + 1 
     print("Well done, next question:") 

    if qe1 != 1: 
      print("Incorrect, next question:") 

    else: 



easy() 
+0

你必須把你的輸入作爲一個整型 –

回答

0

input函數返回一個string,你應該把它轉換爲int

qe1 = int(input("What does RAM stand for?: "))