题3:编写程序,输入一个运算过程,可以产生指定要求的随机数。
要求:(1)产生的随机数要对初始值n敏感,并且可复现,程序中需使用学号m,更换不同的学号,
产生的随机数原理也不同。即:输入不同的n产生的随机数不同,并且输入相同的n产生的随机数相同。
(初值敏感程度大于10-5
,例如n=0.12345与n=0.12346产生的随机数不同)
#程序:
#结果:
(2)利用上一步你编写的代码,产生0-100以内的随机数,并开发猜数字游戏。
输入:输入任意一个数字n,再输入你的学号m,产生随机数,让玩家去猜。
玩家不限次数挑战,猜对后统计玩家猜的次数。
#程序:
#结果:
glossary = {
'string': 'A series of characters.',
'comment': 'A note in a program that the Python interpreter ignores.',
'list': 'A collection of items in a particular order.',
'loop': 'Work through a collection of items, one at a time.',
'dictionary': "A collection of key-value pairs.",
}
word = 'string'
print("\n" + word.title() + ": " + glossary[word])
word = 'comment'
print("\n" + word.title() + ": " + glossary[word])
word = 'list'
print("\n" + word.title() + ": " + glossary[word])
word = 'loop'
print("\n" + word.title() + ": " + glossary[word])
word = 'dictionary'
print("\n" + word.title() + ": " + glossary[word])
https://ask.csdn.net/questions/7965990/54242789?spm=1001.2014.3001.5504
一样的问题