@author bingxian (Ongoing update …)

Day 1

INTRODUCTION

(copy by my IDE, so everything display in code’s way)

this is my Python study place and my study note

there will include major grammar of Python

the code will all be turn into annotation, you can recover the part of code you want to execute

the word in ‘[]’ is ths thoughts of me – bing_xian

# this is an annotation
'''
this is also an annotation
'''
'''
String string is an sequence of char
the most important characteristic the String has in Python is it can search char in a inverted ordersomething like
```pythonword = "hello world"
print(word[-1])```
this code will end up with output : 'd'```pythonword = "1000c"
print(word[0:-1])```
this code will end up with output : '1000''''# print(" -- following is the test place of string -- \n")
#
# print("1.test of inverted order")
# word = "hello world"
# print("the last char of 'hello world' is : " + word[-1] + "\n")
#
# print("2.test of substring")
# num = "1000c"
# print("the '1000c''s substring from index '0' to index '-1' is : " + num[0:-1] + '\n')
#
# print("-- test of string has completed --")'''
assignmentpython's assignment is also special that it have following grammar<variable_1>, <variable_2>, <variable_3>, ... = <expression_1>, <expression_2>, <expression_3>, ...```pythonx = 1
y = 2
x, y = y, x```this is the simple version of```pythonx = 1
y = 2
t = x
x = y
y = t```the emergence of this grammar will immensely simplify the code of Python
[too elegant]'''# print(" -- following is the test of annotation -- \n")
#
# x = 1
# y = 2
# x, y = y, x
#
# print("x = 1\ny = 2\n and when finishing execute x, y = y, x, we would find that : \nx = " + str(x) + "\ny = " +
# str(y) + "\n")
#
# print(" -- test of annotation has completed -- ")'''
input() methodwe can obtain the input from console by method : input()
this method will return a string, whatever input is```pythontempStr = input("please input something ... : ")
print(tempStr)```
result will be the input from console'''# tempStr = input("please input something ... : ")
# print("result is : "tempStr)'''
branch statementPython combine 'else' and 'if' into 'elif' if they been used constantly```pythonif <condition_1>:<code_1>
elif <condition_2>:<code_2>
...
else:<code_N>```
then the <code_1>, <code_2>, ..., <code_N> will be executed in given order'''# tempStr = '123'
# if tempStr[-1] in ['2', '1']:
#     print("the last char of '123' is in the list ['2', '1']")
# elif tempStr[-1] in ['3']:
#     print("the last char of '123' is in the list ['3']")
# else:
#     print('something is going wrong')'''
eval() methodthis method is a great creation that it can turn string into code and execute!!!!!!!!
then it will output the result of this string expression```pythonx = 1
eval("x + 1")
eval("1.1 + 2.2")```
result and 2 and 3.3'''# x = 1
# eval("x + 1")
# eval("1.1 + 2.2")'''
print() methodprint out the variable inside '()'
[so simple that its example is needless]'''# print("this is print() method")'''
loop statementgrammar is :while <condition>:<code>the <code> will be executed again and again till <condition> turns into 'false'```pythoncondition = 1
while condition < 10:print("condition = " + str(condition++))condition = condition + 1```
the variable 'condition' will keep adding up with 1 till it bigger than 10 '''# condition = 1
# while condition < 10:
#     print("condition = " + str(condition))
#     condition = condition + 1'''
keyword 'def''def' can make you define your own custom method```pythondef printOutNum():print("i don't want to obey your order. hum!")printOutNum()```
[this method is tsundere ]'''# def printOutNum():
#     print("i don't want to obey your order. hum!")
#
#
# printOutNum()

Python study_note相关推荐

  1. Github配置(git+vscode+python+jupyter)

    ①下载git 打开 git bash 工具的用户名和密码存储 $ git config --global user.name "Your Name" $ git config -- ...

  2. 【实验楼】python简明教程

    ①终端输入python进入 欣赏完自己的杰作后,按 Ctrl + D 输入一个 EOF 字符来退出解释器,你也可以键入 exit() 来退出解释器. ②vim键盘快捷功能分布 ③这里需要注意如果程序中 ...

  3. 【Kaggle Learn】Python 5-8

    五. Booleans and Conditionals Using booleans for branching logic x = True print(x) print(type(x))''' ...

  4. 【Kaggle Learn】Python 1-4

    [Kaggle Learn]Python https://www.kaggle.com/learn/python 一. Hello, Python A quick introduction to Py ...

  5. 使用python愉快地做高数线代题目~

    今天接触到了python,发现真是极易上手啊!对比c语言是什么鬼东西= = 诶,等下,看完教学文章发现TA在下面写了这句话 如果做了前面的内容你可能已被吸引了,觉得c语言真的是废材! 不...不是的. ...

  6. python 位运算与等号_Python 运算符

    和大多数语言一样,Python也有很多运算符,并且运算符跟其他语言的运算符大同小异接下来一一介绍: 算术运算符: 运算符描述实例 +加 - 两个对象相加a+b的输出结果是30 -减 - 得到复数或者一 ...

  7. python减小内存占用_如何将Python内存占用缩小20倍?

    当程序执行过程中RAM中有大量对象处于活动状态时,可能会出现内存问题,特别是在对可用内存总量有限制的情况下. 下面概述了一些减小对象大小的方法,这些方法可以显著减少纯Python程序所需的RAM数量. ...

  8. python中排序英文单词怎么写_Python实现对文件进行单词划分并去重排序操作示例...

    本文实例讲述了Python实现对文件进行单词划分并去重排序操作.,具体如下: 文件名:test1.txt 文件内容: But soft what light through yonder window ...

  9. python程序如何执行死刑图片_如何判断对象已死

    已死的对象就是不可能被任何途径使用的对象,有以下几种方法判断一个对象是否已经死了: 引用计数 给对象添加一个引用计数器,每当有一个地方引用他,计算器就加 1:当引用失效时,计数器减 1:任何时刻计数器 ...

最新文章

  1. 美多商城之购物车(购物车管理1)
  2. 鸟哥的Linux私房菜(基础学习,服务器架设)
  3. web.xml 配置中classpath: 与classpath*:的区别
  4. 初中数学分几个模块_【初中数学】8大模块61个必考易错知识点!
  5. 2021年速卖通828年中大促活动报名攻略
  6. db2关闭下一句sql的日志_DB2_数据库日志管理
  7. debian重启ssh服务_Jenkins远程部署Linux服务器
  8. powerdesign相关
  9. vba转换为vbs的方法_vba代码改成vbs,该怎么解决(4)
  10. matlab求微分数值,用MATLAB语言求微积分方程的数值解.(xd^2y)/dx^2-5dy/dx+y=0y(0)=0y'(0)=0...
  11. C#.Net工作笔记017---C#事件的理解以及自定义事件的方法
  12. html取元素的文本,解析HTML以获取元素内的文本
  13. 华为海思智能手机处理器及其参数对比
  14. java摄像头_Java实现 海康摄像头抓拍图像
  15. js实现数字金额转换大写及数字加千分符
  16. 互联网和大数据是什么意思_什么是互联网大数据?
  17. VS2012,发布时出现“不支持此接口”错误的解决办法……
  18. KDD CUP 2022 风能预测赛题冠军方案分享
  19. wps怎么恢复成单页_我告诉你文档两页怎么变成单页
  20. 特斯拉如何恢复出厂设置_iphone如何恢复手机出厂设置

热门文章

  1. linux定时任务(crontab)启动sh脚本
  2. 扁平线圈绕线机的优势
  3. pygame实现星际穿越粒子动画
  4. php 将xml转换为数组,php怎么将xml转换成数组
  5. 保险公司理赔作业流程分析
  6. python爬取京东书籍_Python爬取当当、京东、亚马逊图书信息代码实例
  7. DW_Pandas_Task2
  8. 解混沌半导体激光器matlab速率方程,半导体激光器速率方程的求解.PDF
  9. 模建Bentley.STAAD.Pro.Connect.Edition.v21.00.00.57.build.08072017
  10. 机你太美 | 华为vs三星折叠屏大战,结果王自如赢了?!