python入门练手小程序,python简单小程序代码

谁能用python帮我写一个小程序,让用户输入任意9个数字,然后输出排序后的结果。

我只写一个函数:>>> def littleFunc(): data =[] #初始化列表 for i in range(9):#一个for循环 num = int(raw_input("input a number please: "))#控制输入转为int data.append(num)#放入列表 ()#排序 print data#输出python的程序扩展名是.py程序执行结果:>>> littleFunc()input a number please: 1input a number please: 3input a number please: 5input a number please: 7input a number please: 8input a number please: 4input a number please: 9input a number please: 6input a number please: 2[1, 2, 3, 4, 5, 6, 7, 8, 9]。

谷歌人工智能写作项目:小发猫

推荐几个适合新手练手的Python项目

用PYTHON编写一个小程序,输出所有满足条件的素数

按照你的要求编写的Python程序如下import mathfor i in range(100,1000): for j in range (2,int((i))+1):  if i%j==0:   break; else:  if (i%10+i//10%10)%10==i//100:   print(i)源代码(注意源代码的缩进)。

用python编写一个小程序

def input_1():a = raw_input('Please input something:\n')global stst = list(a)print 'Now the list you just inputted is:\n',stsuccess = Truewhile success:input_1()for i in st:c = st.count(i)if c >= 3:print 'You lost!'print 'Error: The number of %s you just input is %s '%(i,c)success = Truebreakprint 'The number of %s you inputted is %s time(s)'%(i,c)success = Falseprint 'Success!'。


相关链接:
1、类型注释 只能用在typescript 中,typescript 函数声明
2、javascript new关键字的原理,js new的过程发生了什么
3、vue3对vue2进行了哪些改进,vue2项目升级为vue3项目
4、神经网络方法研究及应用,神经网络预处理标准化
5、vue使用typescript有什么好处,vue+typescript实战教程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值