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))

#include "stdio.h" void main() { int n,sum=0; printf("请输入一个三位数:"); scanf("%d",&n); sum=n/100+n%100/10+n%10;//百位数+十位数+个位数 printf("这个三位数各位数字之和是%d\n",sum); }

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...

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

for i in range(100,1000): if i%17==0: print(i)

sorted([random.randint(0,10001) for i in range(1000)])[-3:]

#-*coding:utf-8-*d=[1,2,3,4]def getnum(num,digit,length): num1=num for i in range(len(digit)): num=num1*10+digit[i] if length==3: yield num elif length

网站地图

All rights reserved Powered by www.ypnh.net

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