This commit is contained in:
2024-12-19 12:02:28 +08:00
parent 38b9807b5c
commit 3ae7becc40
19 changed files with 148 additions and 39 deletions

View File

@@ -3,24 +3,44 @@
> 抄抄抄
1. 输出保留两位小数
```py
a = 10.2980
print("%.2f" % a)
```
2. 输入一个整数
比如输入128
```py
a=int(input())
```
得到变量a就是整数128
3. 输入两个整数,用空格隔开
比如输入 10 20
```py
n=input().split()
a=int(n[0])
b=int(n[1])
```
4. 输入文字用空格隔开这里用三个文字做例子比如iPhone Huawei Xiaomi
得到变量a就是整数10变量b就是整数20
4. 输入文字,用空格隔开
比如输入 iPhone Huawei Xiaomi
```py
a,b,c=input().split()
n=input().split()
a=n[0]
b=n[1]
c=n[2]
```
得到变量a就是iPhone变量b就是Huawei变量c就是Xiaomi

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

@@ -0,0 +1,81 @@
# 使用 [pythontutor.com](https://pythontutor.com/) 可视化的执行流程
![0](image.png)
由于网站都是英文的,所以接下来我会一步步的截图,请按照顺序执行
## 1. 选择编程语言
![1](image-1.png)
## 2. 在输入框中粘贴代码
![2](image-2.png)
```py
n=1
i=0
while i<5:
i=i+1
n=n*2
print(n)
```
## 3. 点击【可视化执行】按钮
![5](image-5.png)
## 4. 进入调试页面
![4](image-4.png)
① 绿色箭头表示【当前正在】执行的语句
② 红色箭头表示【接下来要】执行的语句
③ 输出结果
④ 显示变量的值
## 5. 基础调试
![3](image-3.png)
5.1 不断点击 ①【Next 下一步】按钮
5.2 代码左侧 ② 出现绿色和红色箭头,指向【当前】和【接下来】的执行语句。
5.3 右侧 ③ 实时展示变量的值
**注意观察箭头的走向和变量值的变化**
![1](PixPin_2024-12-19_11-19-48.gif)
## 6. 拖动进度条 *
可以拖动进度条反复查看或者点击【First】跳到第一步【Last】直接跳到最后一步
![2](PixPin_2024-12-19_11-22-54.gif)
## 7. 更改代码再次调试
点击【Edit this code】按钮可以修改代码
![3](PixPin_2024-12-19_11-26-35.gif)
**可以更改 i 的初始值 i=?,条件符号,条件值,计数器 i=i+? 等**
![6](image-6.png)
比如:
![7](image-7.png)
![8](image-8.png)
![9](image-9.png)
遇到弹框,直接点按钮
![10](image-10.png)