|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
自学python已经一个月了。一直都有用有道云笔记,记录每天学习到的知识,希望自己能坚持记笔记;
好的范例 : 输入三个数,并从小到大排序。
l = []
for i in range (3):
x = int(raw_input('integer:\n'))
l.append(x)
l.sort()
print l
导入随机整数模块
import random
secret = random.randint(1,10)
temp = input ('please your number : ')
guess = int(temp)
while guess != secret:
temp = input ('it\'s wrong,please input again : ')
guess = int(temp)
if guess == secret:
print('you are right!')
print('what\'s do your whant?')
else:
if guess > secret:
print('big')
else:
print('small')
print('over')
斐波那契数列
fibs = [0,1]
num = input ('How many fibonacci numbers do you want? : ')
for i in range(num-2):
fibs.append(fibs[-2]+fibs[-1])
print(fibs
|
评分
-
查看全部评分
|