fix
This commit is contained in:
@@ -29,16 +29,20 @@ print("你的姓名是:"+a)
|
||||
|
||||
```py
|
||||
# 用 int() 包裹 input(),这样得到的 a 就是一个整数类型
|
||||
a = int(input())
|
||||
# 可以加减数字
|
||||
a=int(input())
|
||||
print(a+10)
|
||||
```
|
||||
|
||||
### 输入一个整数,比如输入 3.14
|
||||
输入:10
|
||||
输出:20
|
||||
|
||||
### 输入一个小数,比如输入 3.14
|
||||
|
||||
```py
|
||||
# 用 float() 包裹 input(),这样得到的 a 就是一个小数类型
|
||||
a = float(input())
|
||||
# 得到 3.14-3=0.14
|
||||
a=float(input())
|
||||
print(a-3)
|
||||
```
|
||||
```
|
||||
|
||||
输入:3.14
|
||||
输出:0.14
|
||||
@@ -7,7 +7,7 @@
|
||||
你需要这样写:
|
||||
|
||||
```py
|
||||
a, b = input().split()
|
||||
a,b=input().split()
|
||||
```
|
||||
|
||||
## 输入两个整数,用空格隔开。比如:10 20
|
||||
@@ -15,10 +15,10 @@ a, b = input().split()
|
||||
写法如下:
|
||||
|
||||
```py
|
||||
n = input().split()
|
||||
n=input().split()
|
||||
|
||||
a = int(n[0])
|
||||
b = int(n[1])
|
||||
a=int(n[0])
|
||||
b=int(n[1])
|
||||
```
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ b = int(n[1])
|
||||
写法如下:
|
||||
|
||||
```py
|
||||
n = input().split()
|
||||
n=input().split()
|
||||
|
||||
a = float(n[0])
|
||||
b = float(n[1])
|
||||
a=float(n[0])
|
||||
b=float(n[1])
|
||||
```
|
||||
@@ -1,22 +1,22 @@
|
||||
# 两个文字,用空格隔开,比如:C语言 Python
|
||||
a, b = input().split()
|
||||
a,b=input().split()
|
||||
|
||||
# 三个整数,用空格隔开,比如:1 3 5
|
||||
n = input().split()
|
||||
x = int(n[0])
|
||||
y = int(n[1])
|
||||
z = int(n[2])
|
||||
n=input().split()
|
||||
x=int(n[0])
|
||||
y=int(n[1])
|
||||
z=int(n[2])
|
||||
|
||||
# 四个小数,用空格隔开,比如:1.2 1.4 5.3 0.3
|
||||
n = input().split()
|
||||
a = float(n[0])
|
||||
b = float(n[1])
|
||||
c = float(n[2])
|
||||
d = float(n[3])
|
||||
n=input().split()
|
||||
a=float(n[0])
|
||||
b=float(n[1])
|
||||
c=float(n[2])
|
||||
d=float(n[3])
|
||||
|
||||
# 使用 map 的简化写法
|
||||
# 五个整数用空格隔开
|
||||
a,b,c,d,e = map(int, input().split())
|
||||
a,b,c,d,e=map(int, input().split())
|
||||
|
||||
# 六个小数用空格隔开
|
||||
a,b,c,d,e,f = map(float, input().split())
|
||||
a,b,c,d,e,f=map(float, input().split())
|
||||
Reference in New Issue
Block a user