Commit afc503cc by BellCodeEditor

auto save

parent 5a18a3a1
Showing with 60 additions and 3 deletions
......@@ -101,7 +101,7 @@ while True:
提示用户输入两个正整数,编程求出介于这两个数之间的所有质数并打印输出。
显示格式为"*数是质数。"
'''
'''
a = int(input("请输入开始值:"))
b = int(input("请输入结束值:"))
c = min(a,b)
......@@ -110,13 +110,12 @@ d = max(a,b)
for n in range(c+1,d):
f = "质数"
for i in range(2,n):
# print(n,"/",i)
if n%i==0:
f = "不是质数"
break
if f == "质数":
print(str(n)+"数是质数")
'''
......@@ -155,6 +154,64 @@ while True:
'''
'''
所谓"水仙花数"是指一个三位数,这个三位数各个数位上数字的立方和等于该数本身。
例如:153是一个"水仙花数",因为153=13+5+33。编写程序,计算200到500之间的水仙花数共有多少个。
'''
'''
s = 0
for i in range(200,501):
a = i//100
b = (i-a*100)//10
c = (i-a*100-b*10)
if a**3 + b**3 + c**3 == i:
s+=1
print(s)
'''
# for num in set(1236):
# print(num)
# n = (1,2,3,4)
# n.append(8)
# print(n)
# a=input("请输入字母或数字")
# if ord('a')<=ord(a)<=ord('z') or ord('A')<=ord(a)<=ord('Z'):
# print('字母')
# else:
# print('数字')
# from time import time as tim
# print(tim.time())
class shopping:
def __init__(self,name,money):
self.name = name
self.money = money
self.pen = 0
def buy(self):
while self.money > 10:
self.money = self.money-7
self.pen = self.pen+1
return self.money
n = int(input())
a = shopping('Xiaoming', n)
print(a.buy())
......
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