简单if语句的语法无效

时间:2013-12-14 11:00:31

标签: python if-statement syntax

import time
print ("Hello and welcome to my text adventure!")
time.sleep(2)
Name = input ("What is your name?")
print ("Hello " + Name )
time.sleep(2)
print ("You must choose between joining the Guild or protecting the Girl.")
time.sleep(3)
G = input ("Which do you choose? Guild/Girl")
if: G = "Guild"
    print ("So you chose the Guild. Interesting.")
else print ("So you chose the Girl. How chivalrous.")
# If statements not working.

我不知道这是怎么回事,我已经尝试过稍微移动冒号以确定它是否会起作用,但无济于事......我对此很新,这是我的A - 级别计算课程,所以我需要帮助...

1 个答案:

答案 0 :(得分:2)

应该是

if G == "Guild":
    ...
else:
    ...