大家好,这里是长弓
上一篇我们讲解了python的安装和特性
今天我们来学习python的基础

目录
首先我们要确认之前的安装没有问题:
python的输入与输出
输出:
输入:
练手小程序:
根据输入输出做个自动问好的小程序1:
谁是猪小程序2:
代码编辑器
下载链接:
下载速度较慢解决
?使用python运行
首先我们要确认之前的安装没有问题:
win键+r得到如下弹窗

确定后得到以下页面,输入python得到其版本信息结果便是安装成功。

python的输入与输出
为什么把它放到最开始说呢?
因为要借助计算机帮我们完成工作,必不可少的就是要实现人与计算机的交互,那如何实现两者的交互呢?便是数据的输入和输出。
输出:
print()函数可以实现字符串,整形数据的输出
比如我们输出,我是长弓

?我们发现字符串英文字母和中文都可以正常输出的,与c中的printf()输出不同的是,python的print()中既可以用单引号,也可以用双引号。我们还可以这样输出:

支持多个字符串输出?
输入:
有了输出,我们可以看到数据,下来我们要让计算机看到数据
python中提供了一个input()接口:

name是一个变量,会保存第二行我们输入的值,借助这个变量,我们可以通过直接输入变量名或者print的方式看到数据。?

练手小程序:
根据输入输出做个自动问好的小程序1:

我们在python中运行这个程序:

谁是猪小程序2:

?
语法都是我们上边学过的,输入两个名字,输出B是猪。

代码编辑器
但这些小程序都是需要多行代码构成的,我们无法直接在python逐行输入,因此我们需要下载文本编辑器来编辑和保存代码,而上边我们便使用的Visual Studio Code编辑器。
下载链接:
Visual Studio Code - Code Editing. RedefinedVisual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications.? Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. https://code.visualstudio.com/
下载速度较慢解决
我们下载管理器复制下载链接

点击新建下载

?将net之前替换为? ? ? ? ?http://vscode.cdn.azure.cn
对比网速:

?
?使用python运行

我们编辑好使用左下角ctrl + s 保存代码,便可打开python(python + 文件名)运行代码

这便是借助文本编辑器多行代码的操作。
?
下一篇预告,我们将学习python的一些常用语法和结构
今天的博客就到这里,大家试试看用输入输出还能做出什么好玩的代码
期待大家的分享,我们下次见

|