www.ypnh.net > 请用python写一个代码,题目,输入一个三位数,将...

请用python写一个代码,题目,输入一个三位数,将...

a = input('请输入') print('输入为',a) print('输出为',a[::-1])

a = input("输入一个三位数")print (str(a % 10 % 10) + str(a % 100 / 10) + str(a / 100))

print(' '.join(map(str, (i for i in xrange(100, 100000) if sum(int(c)**3 for c in str(i))==i))))

#!/usr/bin/python# -*- coding:utf-8 -*-# @File : ThreeNum.py"""输入3个数,对三个数进行排列组合"""def percom(olist): import copy slist = [] olen = len(olist) for i in range(olen): otemp = olist[i] slist.append(otemp*olen) temp = ...

#!/usr/bin/python for i in range(1,20): n=str(i) s = n.zfill(3) print s 或者: for i in range(1,20): m = "%03d" % i print m 扩展资料:Python格式化输出 一、整数的输出 1、%o —— oct 八进制 2、%d —— dec 十进制 3、%x —— hex 十六进制...

import randomdef gen3num(): alldigit=[0,1,2,3,4,5,6,7,8,9] first=random.randint(1,9) alldigit.remove(first) second=random.choice(alldigit) alldigit.remove(second) third=random.choice(alldigit) return first*100+second*10+thirdif...

range(100, 1000)

name = input("请输入表达式:")expre = ""for x in name: if x == ' ': continue elif x!= ' ': expre += xprint(eval(expre))你想实现的是将一个字符串的表达式计算出结果?比如 “11 + 12*3”。直接用eval函数就好

s = ""while len( s ) < 10: s = input( "请输入一个长度大于10的数字:" )snum = [int( s[i:i + 3] ) for i in range( len( s ) - 2 )]a = 0while len( str( a ) ) != 3: a = int( input( "请输入一个3位整数:" ) ) lst = list( abs( n - a ) fo...

list = [2,4,5,9,] i=0 m=0 n=0 if i

网站地图

All rights reserved Powered by www.ypnh.net

copyright ©right 2010-2021。
www.ypnh.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com