美文网首页
01python基础

01python基础

作者: Rachelyeah0926 | 来源:发表于2017-12-12 18:23 被阅读20次

python如果报错,bing/GitHub/ 某个网络推荐的网址 /百度

基本运算

数据:
加+ 减- 乘* 除/ 余数% 整除数// 几次方**
文字链:
合并文本 + :‘文本‘ + ’文本‘
复制文本 * : ‘string’ * 5

‘string’+‘string’可行
‘string’+ 数字 不可行——若想让string和数字结合,需要将数字转换成string格式:

>>>str(29)
‘29’
>>>print(‘I am ‘ + str(29) + ‘ years old. ‘)
I am 29 years old.
例如
‘string’ * 数字 复制:
‘Alice’ * 5
‘Alice Alice Alice Alice Alice’

变量使用说明

1.variable 只能是一个单词
2.只能由字母,数字和下划线组成,其他符号均不可以
3.不能用数字作为variable的开始
4.有大小写区分,所以spam Spam spaM 是3个不同的变量

给你的变量一个描述性的内容使你的项目变得更易读。

开始+保存项目


本章学习的3种expression

Floating-point numbers
Strings
integers(整数)


遗留问题

1.下横线怎么输入
2.python中开始项目;保存python项目(我该怎么保存)+如何打开一个已保存的python项目;
3.为什么我输入的program和教材中教的不一样
4.据说python在终端上直接执行很麻烦,是否需要我ipython Notebook来搞 或者是建一个文件?或者下载编辑器?sourcetree是否就是编辑器?
5.我已经可以输入这个program 了,如何让他能够自动运行起来?
6.Why does this expression cause an error? How can you fix it?
'I have eaten ' + 99 + ' burritos.'
Extra credit: Search online for the Python documentation for the len() function. It will be on a web page titled “Built-in Functions.” Skim the list of other functions Python has, look up what the round() function does, and experiment with it in the interactive shell.

Print(‘I have eaten ‘ + ‘99’ + ‘burritos. ’)
The correct way is 
'I have eaten ' + str(99) + ' burritos.'.

Practice

python习题练习chapter01
答案

相关文章

  • Python-01基础-01Python简介

    基础知识-01Python简介 @[toc] Python官网文档(https://www.python.org/...

  • Python-05知识-01Python优缺点.md

    Python-05 知识-01Python 优缺点 tags: Python 基础知识 优缺点 2020年 01月...

  • 01python基础

    python如果报错,bing/GitHub/ 某个网络推荐的网址 /百度 基本运算 数据:加+ 减- 乘* 除/...

  • 01Python基础

    问题:给你一个整数n,从1到n按照下面的规则打印每个数:如果这个数被3整除,打印fizz如果这个数被5整除,打印b...

  • 【负基础学习python】01python基础

    欢迎来到负基础python课堂的第二课 区别于其他教程的一点是,本课程采用的方式是实战中学习。不会一开始就堆砌所有...

  • 01Python介绍

    Python是一门高级的,面向对象的,解释性,脚本语言 主要特点: 1、学习成本低:学习之后可以完成工作且学习占用...

  • 01python入门

    一.数据类型转换 1.浮点型转换成整形 a = 4.052 b = int(a) print(b) 2.字符型转换...

  • 数据分析工程师_01python关键知识点

    01Python关键知识点 目录 [toc] 目录 python介绍 基本数据类型 变量和表达式 字符串 列表 字...

  • 25个关键技术点,带你熟悉Python

    摘要:本文收纳了Python学习者经常使用的库和包,并介绍了Python使用中热门的问题。 01Python 简介...

  • 01python list函数

    添加新元素 list.append() list.insert(n, '4') list.extend(list2...

网友评论

      本文标题:01python基础

      本文链接:https://www.haomeiwen.com/subject/qgunixtx.html