Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
32 lines (21 loc) · 581 Bytes

File metadata and controls

32 lines (21 loc) · 581 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding:utf-8 -*-
__author__ = 'gjw'
__time__ = '2018/1/10 0010 下午 2:20'
# 题目:输入3个数a,b,c,按大小顺序输出。
if __name__ == '__main__':
n1 = int(input('n1 = :\n'))
n2 = int(input('n2 = :\n'))
n3 = int(input('n3 = :\n'))
def swap(p1, p2):
return p2, p1
if n1 > n2: n1, n2 = swap(n1, n2)
if n1 > n3: n1, n3 = swap(n1, n3)
if n2 > n3: n2, n3 = swap(n2, n3)
print(n1, n2, n3)
# 列表
print("使用列表")
a = []
for i in range(3):
a.append(int(input("请输入一个数字:")))
a.sort()
print(a)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.