Commit 460fc531 by BellCodeEditor

auto save

parent 05e7d622
n=input()
num=int(input())
sum=0
str=''
for i in range(num):
str=str+n
sum=sum+int(str)
print(sum)
\ No newline at end of file
num1 = input('请输入所要相加的数字:')
num2 = int(input('请输入所要相加的次数'))
sum=0
str=""
for i in range(num2):
str = str + num1
sum = int(str) + sum
\ No newline at end of file
str=input('请输入三条边:')
nums=eval(str)
c=list(nums)
c.sort() #从小到大排序
print(c)
if c[0] + c[1] > c[2]:
print('边长{} {} {} 能形成三角形'.format(c[0],c[1],c[2]))
if c[0]**2 + c[1]**2 == c[2]**2:
print('这是直角三角形')
elif c[0] == c[1] or c[1] == c[2]:
print('这是等腰三角形')
else:
print('这是一个普通的三角形')
else:
print('不能形成三角形')
\ No newline at end of file
for i in range(1,10): #包含1 不包含10
for j in range(1,i+1):
print(str(j)+'*'+str(i)+'='+str(j*i),end='\t')
print()
file1=open(r'C:\Users\bellcode\Desktop\myfile.txt','w',encoding='utf-8')
file1.write('您好:12')
file1.close()
\ No newline at end of file
with open(r'C:\Users\bellcode\Desktop\myfile.txt','a',encoding='utf-8') as file:
file.write('你好,')
def new_input():
total = []
while True:
new = input('请输入价格按结束:') #字符串
if new == 'q':
break
else:
try:
new1 = int(new) #整形
except:
print("要输入整数啊")
else:
total.append(new1)
finally:
print('-'*30)
return total
print(total)
def sum1(money):
sum = 0
for i in money:
sum = sum + i
print(sum)
return sum
new2=new_input()
sum1(new2)
\ No newline at end of file
for i in range(5):
print(i) #打印函数
\ No newline at end of file
num=0
num1=90321
while True:
if num1%3==2 and num1%7==6 and num1%11==10 and num1%17==16 and num1%23 ==22:
for i in range(2,90321):
if num1 % i == 0:
break
else:
print(num1)
num = num +1
if num == 10:
break
def new_count():
count = []
while True:
str1 = input('请输入数字:')
if str1 == "q":
break
else:
try:
str2 = int(str1)
except:
print("请重新输入")
else:
count.append(str1)
print(count)
new_count()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment