Python中的Point System

我想添加一个点系统,所以如果(x)赢得了一个点,如果(y)赢得了一个点,但是我不知道如何启动它并保持编程循环,以便程序可以继续前进并保持要点。很抱歉,如果这很难理解,我正在读高中,这只是学校以外的一个有趣的小项目。

whj901180 回答:Python中的Point System

您的问题非常广泛,但是这里有一些起始代码可以使您朝着正确的方向前进。将此代码放在python文件中并运行它!

def main():
  x,y = 0,0
  while True:   
    print(x,y)

    someInput = input("Your input is?") # If input not required remove this
    if someInput == 'y': # Change conditional to y wins condition
        y += 1
    elif someInput == 'x': # Change conditional to x wins condition
        x += 1
    else: # Change conditional to end program condition
        break

if __name__ == '__main__':
    main()

这应该足以帮助您入门,否则,您将需要发布已经在使用的任何代码。

本文链接:https://www.f2er.com/3017355.html

大家都在问