python 日记 day1
1.python2 与 python3 的区别:
a. python2 源码不标准,混乱,重复代码太多。默认方式是ascii码,解决方式:#-*- encoding:utf-8 -*-
b. python3 统一 标准,去除重复代码。默认方式是utf-8
2.python 的特点及定位是“优雅”、“明确”、“简单”。python 开发效率高,有非常强大的第三方库,具有可移植
性,可扩展性,可嵌入性。代码不能加密,因为python是解释性语言,它的源码都是以名文形式存放的。
3.编译型:一次性将所有程序编译成二进制文件。
缺点:开发效率低,不能跨平台。
优点:运行速度快。 例如:c,c++,go
解释型:当程序运行时,一行一行的解释。
优点:开发效率高,可以跨平台。有良好的兼容性,在任何环境下都可以运行,前提是安装虚拟机。
缺点:运行速度慢,每次运行都要解释一遍。 例如:python ,php,ruby。
java , c# 属于混合
4.重点:python 是一门动态解释性的强类型定义语言。
5.变量:以数字,字母,下划线任意组成,不能以数字开头
常量:全部为大写字母。
6.基础数据类型:
数字:int 1,2,3,4,5 数的取值范围: -2**63~2**63-1
运算符:+ - * / ** %
ps:type() 用以判断是数字还是字符串。例: print(True,type(True))
字符串:str 可相加 可相乘 str * int.python 中用引号引起来的都是字符串。
7.打印多行举例:
msg='''hello
hello
hello'''
age = int(input('输入你的年龄:',))
if age < 18:
print('你太小了才'+str(age)+'岁')
elif age < 30:
print('哇塞你都' + str(age) + '岁')
else:
print('你终年' + str(age) + '岁')''
2.
count = 1
sum = 0
while count <= 100:
sum += count
count +=1
print(sumi)
age = int(input('输入你的年龄:',))
if age < 18:
print('你太小了才'+str(age)+'岁')
elif age < 30:
print('哇塞你都' + str(age) + '岁')
else:
print('你终年' + str(age) + '岁')'''
count = 0
while count < 10:
count +=1
if count == 7:
continue
print(count)
count =1
sum =0
while count <=100:
sum +=count
count +=1
print(count)
count = 0
while count < 100:
count +=1
if count % 2 == 1:
print(count, end=" ")
count = 0
while count < 100:
count += 1
if count % 2 == 0:
print(count, end=" ")
count = 1
sum = 0
while count < 100: if count % 2 == 0:
sum = sum - count
else:
sum = sum + count
count += 1
print(sum)
i=0
while i < 3:
username = input("输入用户名:")
password = input("输入密码:")
if username == "**" and password == 123:
print("登陆成功")
else:
print("登陆失败")
i +=1
python 日记 day1的更多相关文章
- python日记---day1
Life is short,Test in python 一.输入输出 1.用print()在括号中加上字符串,就可以向屏幕上输出指定的文字.比如输出'hello, world' print('h ...
- 量化分析师的Python日记【第1天:谁来给我讲讲Python?】
量化分析师的Python日记[第1天:谁来给我讲讲Python?]薛昆Kelvin优矿 001 号员工2015-01-28 15:48 58 144克隆 ###“谁来给我讲讲Python?” 作为无基 ...
- 学习Python的day1
自己以前从来没有写博客的想法,但是学Python,里面的老师也说了,写博客可以加深自己的记忆,也能回顾内容.还能给别人参考.挺值的.2017-09-16 一. Python介绍 python的创始人为 ...
- python基础 Day1
Python开发笔记 Day1 1.cpu内存 硬盘 操作系统 cpu:计算机的运算和计算中心,相当于人类大脑 内存:暂时存储数据,临时加载数据应用程序,4G(内存速度快,断电即消失) 硬盘:磁盘,长 ...
- Python学习-day1
Mark一下,python学习. 今天一天已1.5x的速度看完了Alex老师的第一周的视频,先是4节鸡汤课,而且给了勺,讲述了python目前在世界的地位,发展趋势,以及未来的愿景. 最重要的还是写一 ...
- python开发 Day1 python基础
编程语言主要从以下几个角度为进行分类,编译型和解释型.静态语言和动态语言.强类型定义语言和弱类型定义语言,每个分类代表什么意思呢,我们一起来看一下. 编译和解释的区别是什么? 编译器是把源程序的每一条 ...
- python学习day1
python简单介绍: Python的创始人为Guido van Rossum.1989年圣诞节期间,在阿姆斯特丹,Guido为了打发圣诞节的无趣,决心开发一个新的脚本解释程序,做为ABC 语言的一种 ...
- python学习——DAY1
日期:20170113 一.个人体会: 零基础学python,是艰辛的,需要付出和坚持. 关于流程图.我最开始画的是从上到下,再从左到右,画了很多重复的内容,单线程的流程图,看起来很容易理解,但是自己 ...
- python日记_01 python实现6个人围成一圈,扔到第三个人出局,循环扔的问题。
#!/usr/bin/python shoplist=['mango','apple','carrot','banana','oracle','python'] length = len(shopli ...
随机推荐
- LUOGU P3919 【模板】可持久化数组(主席树)
传送门 解题思路 给每一时刻建一棵线段树维护当前时刻的值,然后修改的时候直接修改,查询的时候直接查,记住查询完后一定要复制. 代码 #include<iostream> #include& ...
- Windbg 查看SSDT表
SSDT HOOK 的原理其实非常简单,我们先实际看看KeServiceDescriptorTable是什么样的. lkd> dd KeServiceDescriptorTabl ...
- spring源码读书笔记
如果我们在web项目里面使用spring的话,通常会在web.xml里面配置一个listener. <listener> <listener-class> org.spring ...
- Caused by: java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
报错信息 Error starting ApplicationContext. To display the auto-configuration report re-run your applica ...
- Day 8 : Python 文档操作
Python 文件的操作方法: 打开文件 f = open('test','r',encoding='utf-8') #f :文件句柄 #test:文件绝对路径 #r:打开方式 #encoding 打 ...
- typeerror: __init__() missing 2 required positional arguments: 'inputs' and 'outputs'
1 问题描述 使用下边这条命令去检查 TensorFlow Object Detection API是否正确安装: python object_detection\builders\model_bui ...
- UMP系统功能 容灾
- JConsole&VisualVM监控总结
简介JConsole(以下写作jconsole),VisualVM(以下写作jvisualvm ) 都是比较好的JVM调优工具,且都为JDK自带,可在命令行直接启动. 监控示例Server端(需要监控 ...
- oi知识表
- where方法的用法是ThinkPHP查询语言的精髓
where方法的用法是ThinkPHP查询语言的精髓,也是ThinkPHP ORM的重要组成部分和亮点所在,可以完成包括普通查询.表达式查询.快捷查询.区间查询.组合查询在内的查询操作.where方法 ...