Commit f951b2a3 by BellCodeEditor

save project

parent e0893773
Showing with 26 additions and 25 deletions
a = int(input())
b = int(input())
def arr(a,b):
s = a*b
return s
def brr(a,b):
c = a * 2 + b * 2
return c
print(arr(a,b))
print(brr(a,b))
import random
a = int(input())
arr = []
for i in range(a):
arr.append(random.randint(1,100))
print(arr)
def sum(arr):
we = 0
for i in arr:
we += i
return we
c=sum(arr)/a
print(round(c,2))
\ No newline at end of file
def func():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit = int(unit)
except:
print('请重新输入一个数字')
else:
total.append(unit)
finally:
print("-"*30)
return total
def sum(money):
count = 0
for i in money:
count = count + i
return count
price = func()
pay = sum(price)
print('您一共消费了' + str(pay) + '元!扫码还是现金呢')
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