Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 我想做一个数学天才的游戏,但我无法让它工作_Python 3.x - Fatal编程技术网

Python 3.x 我想做一个数学天才的游戏,但我无法让它工作

Python 3.x 我想做一个数学天才的游戏,但我无法让它工作,python-3.x,Python 3.x,这段代码哪里出错了?您需要修改最后两条语句,如下所示: import random from time import sleep import math print('Hello! What is your name?') myName = input() print('Welcome to the math wiz game!') print('Lets start with the easy stuff!') print('what is 2*4?') if input == 8:

这段代码哪里出错了?

您需要修改最后两条语句,如下所示:

import random
from time import sleep
import math

print('Hello! What is your name?')
myName = input()
print('Welcome to the math wiz game!')
print('Lets start with the easy stuff!')
print('what is 2*4?')
if input == 8:
    print('Your right!')

不需要进口。 这是正确的版本

ans1 = int(input('What is 2*4?\n'))
if ans1 == 8: 
    print("You're right!")
else:
    print("Sorry")

嗨,凯,欢迎来到StackOverflow。请参阅问题发布指南,并相应更新您的问题。谢谢
    print('Hello! What is your name?')
    myName = input()
    print('Welcome to the math wiz game!')
    print('Lets start with the easy stuff!')
    print('what is 2*4?')
    NewVariable = input()
    if a == 8:
        print("Your right!")
    else:
        print("You don't even know this!")