Python Mosh 学习笔记(6小时完全入门)

Python Mosh 学习笔记


这两个博主写得都挺好的。
六小时极速入门
Python笔记 code with Mosh

02:01:45 2D Lists
02:05:11 My Complete Python Course
02:06:00 List Methods
02:13:25 Tuples
02:15:34 Unpacking
02:18:21 Dictionaries
02:26:21 Emoji Converter
02:30:31 Functions
02:35:21 Parameters
02:39:24 Keyword Arguments
02:44:45 Return Statement
02:48:55 Creating a Reusable Function
02:53:42 Exceptions
02:59:14 Comments
03:01:46 Classes
03:07:46 Constructors
03:14:41 Inheritance
03:19:33 Modules
03:30:12 Packages
03:36:22 Generating Random Values
03:44:37 Working with Directories
03:50:47 Pypi and Pip
03:55:34 Project 1: Automation with Python
04:10:22 Project 2: Machine Learning with Python
04:58:37 Project 3: Building a Website with Django

目录
00:00:00 简介
00:01:49 安装Python 3
00:06:10 您的第一个Python程序
00:08:11 如何执行Python代码
00:11:24 学习Python需要多长时间
00:13:03 变量
00:18:21 接收输入
00:22:16 Python备忘单
00:22:46 型号转换
00:29:31 字符串
00:37:36 格式化字符串
00:40:50 字符串方法
00:48:33 算术运算
00:51:33 运算符优先级
00:55:04 数学函数
00:58:17 国际单项体育联合会声明
01:06:32 逻辑运算符
01:11:25 比较运算符
01:16:17 重量转换器程序
01:20:43 While循环
01:24:07 制作猜谜游戏
01:30:51 打造汽车游戏
01:41:48 循环
01:47:46 嵌套循环
01:55:50 名单
02:01:45 二维列表
02:05:11 我的完整蟒蛇课程
02:06:00 列表方法
02:13:25 元组
02:15:34 拆包
02:18:21 字典
02:26:21 表情转换器
02:30:31 功能
02:35:21 参数
02:39:24 关键字参数
02:44:45 返回语句
02:48:55 创建可重用函数
02:53:42 例外
02:59:14 评论
03:01:46 类
03:07:46 施工人员
03:14:41 继承
03:19:33 模块
03:30:12 包裹
03:36:22 生成随机值
03:44:37 使用目录
03:50:47 皮皮和皮皮
03:55:34 项目1:使用Python实现自动化
04:10:22 项目2:使用Python进行机器学习
04:58:37 项目3:与Django建立网站

来自于b站视频 BV14J411U7hj
6小时完全入门的代码/笔记

print("Hello World!")
print('o----')
print(' ||||')
print('*' * 10)
price = 10
price = 20
print(price)
rating = 4.9
name = 'HELLO'
is_published = True
# python对大小写敏感,true这个就是错误的布尔值,必须是True
i_published = False
patient_name = 'John Smith'
patient_age = 20
patient_status = 'New'
patient_status_plus = True
is_new = True
# name = input('What is your name? ')
print('Hi ' + name)
name = input('What is your name? ')
color = input('What is your favorite color? ')
print(name + ' likes ' + color + '.')

截止到0:38:51

birth_year = input('Birth year: ')
# input函数,无论你在终端输入什么,都会被认为是字符串类型的
# 2020 - ‘1999’ python don't know how to do
# int()
# float()
# bool()
# 以上函数是强制转换类型
# 获得变量的类型,并打印类型的函数 type()函数获取括号内变量的数据类型
print(type(birth_year))
age = 2020 - int(birth_year)
print(type(age))
print(age)
# 下面是错误范例 int(weight)
# weight是str类型的
# 通过 int(weight)函数,请问weight变成什么类型了
weight = '70'
int(weight)
print(type(weight))
# 可以看出<class 'str'>,weight依然是str类型的
# weight = input('What your weight in pounds? ')
# int(weight)
# weight_kg = weight * 0.45
# print(weight_kg)
# 所以改为如下
weight = input('What your weight in pounds? ')
weight_kg = int(weight) * 0.45
print(weight_kg)
print(str(weight_kg) + 'kg')
# course = 'Python's Course for Beginners' 这句会报错,因为在''s之前字符串就结束了
# 双引号的作用 这时候就可以运用双引号
course = "Python's Course for Beginners"
print(course)
# 同样单引号也有这种用法
course = 'Python for "Beginners"'
print(course)
course = '''
Hi John

Here is our first email to you.

Thank you,
The support team
'''
print(course)
course = 'Python for Beginners'
print(course[0])  # 这个就是索引,我们在其它编程语言中没有的特性之一 P
print(course[-1])   # s
print(course[-2])   # r
print(course[0:3])  # Pyt
print(course[0:])   # Python for Beginners
print(course[1:])
print(course[:5])
# copy [:]
course = 'Python for Beginners'
another = course[:]
print(another)
name = 'Jennifer'
print(name[1:-1])

截止到0:59:28

import math  # import 要放在最上方
# You can search in Google : Python 3 math model, then you could see the file about it.
print(math.ceil(2.9))  # ceil向上取整
print(math.floor(2.9))  # floor向下取整
first = 'John'
last = 'Smith'
message = first + ' [' + last + '] is a coder'
msg = f'{first} [{last}] is a coder'
print(message)
print(msg)
course = 'Python for Beginners'
print(len(course))
print(course.upper())
print(course.lower())
print(course)
print(course.find('P'))
print(course.find('o'))
print(course.find('O'))
print(course.replace('Beginners', 'Absolute Beginners'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值