图形题
1.1. 求s=a+aa+aaa+aaaa+aa...a的值,其中a是⼀一个数字。例例如2+22+222+2222+22222(此时共有5个数相 加),⼏几个数相加有键盘控制。
"""value = 0
a = int(input("请输入几个数相加的个数"))
value1 = int(input("请输入第一个数字"))
for i in range(0,a):
if i == 0:
j = value1
else:
j = j*10 +value1
value += j
print(value)
"""
打印图形01
'''
n = int(input("行数"))
m = input("请输入一个符号")
for i in range(0,n):
a = m*(i+1)
print(a)
'''
'''n = int(input("请输入行数"))
m = input("请输入符号")
c = 0
for i in range(0,2*n,2):
a = m*(i+1)
c += 1
b =" "*(n-c)
print(b,a,sep=(''))
'''
n = input("请输入符号")
m = int(input("请输入行数"))
for i in range(m,0,-1):
a = n*i
print(a)
5输⼊入两个正整数m和n,求其最⼤大公约数和最⼩小公倍数。
'''
m = int(input("请输入一个正整数"))
n = int(input("请输入一个正整数"))
z = []
k = []
for i in range(1,m+1):
if m%i ==0 and n%i ==0:
z.append(i)
a = m*n/(max(z))
print("最小公倍数为:",a)
print("最大公约数为:",max(z))
'''
6. ⼀一个数如果恰好等于它的因⼦子之和,这个数就称为 "完数 "。例例如6=1+2+3.编程 找出1000以内的所有完数
'''
list2 = []
for i in range(1,1001):
list1 = []
for j in range(1,i):
if i%j == 0:
list1.append(j)
if sum(list1) == i:
list2.append(i)
print(list2)
'''
#输出9*9⼝口诀
'''
for i in range(1,10):
for j in range(1,i+1):
a = i * j
print(j,"*",i,"=",a ,end=" ")
print("")
'''
⼀一个5位数,判断它是不不是回⽂文数。即12321是回⽂文数,个位与万位相同,⼗十位与千位相同。
'''
num1 = input("请输入一个五位数")
a = []
list1 = []
for i in range(0,len(num1)) :
list1.append(i)
if num1[i] != num1[len(num1) -1- i]:
print(num1,"不是回文数")
a.append(num1)
break
if num1 not in a:
print(num1,"是回文数")
'''