【发布时间】:2017-12-02 16:42:20
【问题描述】:
我是一个 9 岁的孩子,正在尝试自动计算我的算盘中的随机数。
我想随机生成值并将它们存储在内存中以备后用,当我按下检查添加时。那么它应该给出所有随机数的相加值。
到目前为止我有这个代码
# my abacus training app
import random
import time
print ('hey what\'s your name')
name = input()
print("well today i am goingto ask abacus questions ")
print ("choose a level")
levelOne = print ("level 1")
print (levelOne)
choice = input()
if choice.endswith("1") :
print("let's start")
noone = random.randint(1,10)
print (noone)
time.sleep(5)
notwo = random.randint(1,10)
print (notwo)
time.sleep(5)
nothree = random.randint(1,10)
print (nothree)
time.sleep(5)
nofour = random.randint(1,10)
print (nofour)
time.sleep(5)
nofive = random.randint(1,10)
print (nofive)
time.sleep(5)
=======我正在发布上述问题的最终答案,这是我的最终代码,感谢 Srig 和 Hamed Temsah 的输入===感谢所有支持我的人。
# my abacus training app
import random
import time
print ('hey what\'s your name')
name = input()
print("well today i am goingto ask abacus questions ")
print ("choose a level")
choice = input("choose a level : ")
if choice.endswith("1") :
print("let's start")
noone = random.randint(1,10)
print (noone)
time.sleep(10)
notwo = random.randint(1,10)
print (notwo)
time.sleep(10)
nothree = random.randint(1,10)
print (nothree)
time.sleep(10)
nofour = random.randint(1,10)
print (nofour)
time.sleep(10)
nofive = random.randint(1,10)
print (nofive)
time.sleep(10)
print ("click enter to check your ans")
input ()
print(noone+notwo+nothree+nofour+nofive)
【问题讨论】:
-
您收到的错误或遇到的问题是什么?
-
你想用这条线做什么?
levelOne = print ("level 1") -
PyGame 在你的问题中在哪里?你为什么设置标签'pygame'?
-
我想用那条线打印第 1 层并存储它
-
@PranayKumar 这样做不会存储值。
标签: python python-3.x python-2.7