循序渐进学Python2变量与输入
新建一个test.py文件,右键选择“Edit with IDLE”,编辑完成后,Ctrl+S保存,然后按下F5就可以执行代码了。
注:IDLE是Python官方提供的一个IDE工具。
目录[隐藏] |
[编辑]注释
#This is a comment
print"This will run."#comment
多行注释使用三个单引号(''')或三个双引号(""")。
[编辑]数字
print 25 + 30 / 6
print"Is it true that 3+2 < 5-7?"
print 3+2<5-7
输出:
30 Is it true that 3+2<5-7? False
[编辑]变量
cars =100
print"There are", cars,"cars available."
输出:
There are 100 cars available.
my_name ="Lei Jun" your_name ="Jobs"
print"Let's talk about", my_name print"Let's talk about %s and %s." % (my_name, your_name)
输出:
Let's talk about Lei Jun Let's talk about Lei Jun and Jobs.
[编辑]输入用法
print"How old are you?" age =raw_input()
print"You're %s old."% age
输出:
How old are you? 27 You're 27 old.
或
age =raw_input("How old are you?")
print"You're %s old."% age
输出:
How old are you?38 You're 38 old.
循序渐进学Python2变量与输入的更多相关文章
- 循序渐进学.Net Core Web Api开发系列【7】:项目发布到CentOS7
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇讨论如 ...
- 学python2.7简单还是python3.0简单,两者区别
学python2.7简单还是python3.0简单,谈谈两者区别 1. 使用__future__模块 Python 3.X 引入了一些与Python 2 不兼容的关键字和特性.在Python 2中,可 ...
- 循序渐进学.Net Core Web Api开发系列【14】:异常处理
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍异 ...
- 循序渐进学.Net Core Web Api开发系列【13】:中间件(Middleware)
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍如 ...
- 循序渐进学.Net Core Web Api开发系列【11】:依赖注入
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍如 ...
- 循序渐进学.Net Core Web Api开发系列【9】:常用的数据库操作
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇描述一 ...
- 循序渐进学.Net Core Web Api开发系列【6】:配置文件appsettings.json
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.本篇概述 本篇描 ...
- 循序渐进学.Net Core Web Api开发系列【3】:WebApi开发概览
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 目前我们已 ...
- 循序渐进学.Net Core Web Api开发系列【2】:利用Swagger调试WebApi
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 既然前后端 ...
随机推荐
- P1438 无聊的数列 (线段树)
题目链接 Solution 直接维护一个差分的线段树就好了. 其中线段树的节点代表 \(r\) 比 \(l\) 多多少. Code #include<bits/stdc++.h> #def ...
- Miracast HDCP 等知识
Miracast 通讯架构中关于视频数据处理流程的部分.整个视频数据处理及传输的流程,大致上分为几个阶段,一开始将撷取到系统的画面及声音进行压缩,而压缩后的影音数据再转为基本封包串流(Packetiz ...
- 【HDOJ6229】Wandering Robots(马尔科夫链,set)
题意:给定一个n*n的地图,上面有k个障碍点不能走,有一个机器人从(0,0)出发,每次等概率的不动或者往上下左右没有障碍的地方走动,问走无限步后停在图的右下部的概率 n<=1e4,k<=1 ...
- 在Ubuntu / Ubuntu Kylin下安装和卸载 Nodepadqq
在Ubuntu / Ubuntu Kylin下安装和卸载 Nodepadqq 对于Ubuntu发行版本可以通过PPA安装,命令如下: sudo add-apt-repository p ...
- ThinkPHP 的 Vender的简单实用
ThinkPHP 的 Vender的简单实用 框架版本:3.2 示例一.调用二维码类: Vendor('phpqrcode.phpqrcode'); $QRcode = new \QRcode (); ...
- iOS-tableView上拉加载更多后,界面出现偏移
问题描述: 在做tableview的界面展示的时候,cell用自动计算高度的.但是在上拉加载更多的时候,数据请求完后,刷新界面,界面的顶部就出现了偏移 分析: 查阅资料后发现,当tableView的c ...
- Android中沉浸式状态栏的应用
在Android5.0版本后,谷歌公司为Android系统加入了很多新特性,刷新了Android用户的体验度.而其中的一个新特性就是沉浸式状态栏.那么问题来了,很多非移动端的小伙伴就要问了,什么是沉浸 ...
- 微信小程序 使用微信支付功能实现在线订单支付
以前做过PC页面微信支付,但是这次在小程序 直接调用微信支付功能还是方便很多 先放个微信官方API链接:https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_a ...
- Codeforces 321D Ciel and Flipboard(结论题+枚举)
题目链接 Ciel and Flipboard 题意 给出一个$n*n$的正方形,每个格子里有一个数,每次可以将一个大小为$x*x$的子正方形翻转 翻转的意义为该区域里的数都变成原来的相反数. ...
- SPOJ LIS2 - Another Longest Increasing Subsequence Problem(CDQ分治优化DP)
题目链接 LIS2 经典的三维偏序问题. 考虑$cdq$分治. 不过这题的顺序应该是 $cdq(l, mid)$ $solve(l, r)$ $cdq(mid+1, r)$ 因为有个$DP$. #i ...