python
YUJING0727
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python_case_2
约瑟夫生者死者小游戏。30人在一条船上,现在由于超载需要15人下船。给30人编号,从1开始报数,数到9的人下船,如此反复,直到15人全部下船。问有哪些编号的人下船了。people = {} # 集合i=1 # 每人的编号j=0 # 计数下船的人check=0 # 当前1-9人的计数for i in range(1,31): people[i] = 1 while i<=31: if i == 31: i = 1 e原创 2021-05-23 21:07:31 · 485 阅读 · 0 评论 -
python3_basic
print print("hello") print(a) print("hello"+a) variable string with functions number with functions boolean input("enter a name: ") int(input("enter a num: ")) float(input("enter a num: "))原创 2021-05-19 20:55:28 · 178 阅读 · 0 评论 -
python3_case_1
#求平方根import cmatha=float(input("please enter a number\n"))print("the sqrtof {0:.2f} is {1:.2f}" .format(a, cmath.sqrt(a)))#outputthe sqrtof 4.00 is 2.00+0.00j#生成随机数import randomprint(random.randint(1,9)) #产生1~9之间的随机数#output7#交换两个数..原创 2021-04-17 23:14:56 · 259 阅读 · 2 评论 -
python3_input&output
输入input(" the program is ongoing\n")输出原创 2021-04-17 12:46:38 · 202 阅读 · 0 评论
分享