Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-4-1_DIY1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bfa40292
authored
Mar 23, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
ce20da48
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
11 deletions
jk.py
jk.py
View file @
bfa40292
if
player
==
computer
:
# #方法一
print
(
"平局"
)
# a,b,c = input('输入内容').split()
elif
player
==
"石头"
and
computer
==
"剪刀"
:
# A=int(a)
print
(
"恭喜,你赢了"
)
# B=int(b)
elif
player
==
"剪刀"
and
computer
==
"布"
:
# C=int(c)
print
(
"恭喜,你赢了)
# print((A+B)*C)
elif player=="
布
"and computer=="
石头
":
# # 方法二
print("
恭喜你,你赢了
")
# a,b,c =map(int,input('输入内容').split())
else:
# print((a+b)*c)
print("
很遗憾,你输了
")
\ No newline at end of file
# 问题描述
# 输入 A B 输出结果A+B
# 输入的第一行包括两个整数,空格隔开,分别表示A,B
# 输出一行,包括A+B这个表达公式,也包括答案
# 例子
# 3 6
# 结果
# 3+6=9
# 问题描述
# 将这个数列从小到大排序,1<=n<=200
# 输入格式
# 输入一些数字,从小到大排序,空格隔开
# 输出格式
# 输出一行,按从小到大的顺序排序后的数列
# 例子
# 5 8 4 7 1
# 结果
# 1 4 5 7 8
#第一种方法 冒泡排序
def
mao
(
num_list
):
num
=
len
(
num_list
)
#控制循环次数
for
i
in
range
(
num
):
# 7 9 2 5
for
j
in
range
(
num
-
1
-
i
):
if
a
[
j
]
>
a
[
j
+
1
]
:
a
[
j
],
a
[
j
+
1
]
=
a
[
j
+
1
],
a
[
j
]
a
=
list
(
map
(
int
,
input
()
.
split
()))
mao
(
a
)
print
(
a
)
#第二种方法
# a = list(map(int,input().split()))
# a.sort()
# print(a)
# sort()函数:应用于列表,意思是排序
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment