2019.4.22登记

课堂笔记 2019.4.8

在windows环境下,用python写出第一个程序“hello world”

 print("Hello World!!!")

课堂笔记 2019.4.12

在windows环境下,用python写出第一个用户交互程序“input”

 death_age=120

 print("game star")
print("")
print("") name=input("input your name:")
age=input("input your age:") print(name,"still able to live",death_age-int(age),"years")

课堂笔记2019.4.13

python程序<数字比大小>: 用户输入3个数字,输出最大的数字和最小的数字

 #My idea

 '''
No1=int(input("please input first number:"))
No2=int(input("please input scend number:"))
No3=int(input("please input third number:")) if No1>No2>No3:
print("Max No is No1:",No1,"Min No is No3:",No3)
elif No1>No3>No2:
print("Max No is No1:",No1,"Min No is No2:",No2)
elif No2>No1>No3:
print("Max No is No2:",No2,"Min No is No3:",No3)
elif No2>No3>No1:
print("Max No is No2:",No2,"Min No is No1:",No1)
elif No3>No1>No2:
print("Max No is No3:",No3,"Min No is No2:",No2)
elif No3>No2>No1:
print("Max No is No3:",No3,"Min No is No1:",No1)
''' #teather's idea. only MaxNo,no MinNo '''
No1=int(input("please input first number:"))
No2=int(input("please input scend number:"))
No3=int(input("please input third number:")) No=0 if No1>No2:
No=No1
if No>No3:
print("Max No is:",No)
else:
print("Max No is:",No3)
else:
No=No2
if No>No3:
print("Max No is:",No)
else:
print("Max No is:",No3)
''' #bettet idea No1=int(input("please input first number:"))
No2=int(input("please input scend number:"))
No3=int(input("please input third number:")) max_No=0
min_No=0 if No1>No2:
max_No=No1
if max_No<No3:
min_No=No2
print("Max No is:",No3,"Min No is:",min_No)
else:
if No2<No3:
min_No=No2
print("Max No is:",max_No,"Min No is:",min_No)
else:
min_No=No3
print("Max No is:",max_No,"Min No is:",min_No)
else:
max_No=No2
if max_No<No3:
min_No=No1
print("Max No is:",No3,"Min No is:",min_No)
else:
if No1<No3:
min_No=No1
print("Max No is:",max_No,"Min No is:",min_No)
else:
min_No=No3
print("Max No is:",max_No,"Min No is:",min_No)

课堂笔记2019.4.14

python的四种运算符:算数运算符,赋值运算符,比较运算符,逻辑运算符。

算数运算符:+,-,*,/,//,%,**

赋值运算符:word="hello"(赋值字符串) , word=23(赋值数字)

比较运算符:<,>,==,!=

逻辑运算符:not , and , or (and和or有短路原则,如果条件1结果已知,后续代码不再执行)

课堂笔记2019.4.15

while语句:打印1-10

 #打印1=10
No = 1 while No<=10:
print(No)
No+=1

课堂笔记2019.4.16

1.编写一个猜测年龄的程序

 #猜年轻

 ''' 用if语句判断
goal_age=76 guess_age=int(input("please guess age(1-100):")) # print(guess_age,goal_age) if(guess_age==goal_age):
print("you got it")
else:
print("sorry,you are wrong")
''' #利用while实现一直输入
'''
暂时无法实现2个问题:
1.从输错了数字开始算起的区间(比如输入两个数字(34,89)后,无法提醒在(34-89)之间的数字猜测)
2019.4.22号已自行解决
2.由用户自己选择放弃猜测退出程序. 2019.5.6 已解决 '''
goal_age = 76 guess_age = int(input("please guess age(1-100):"))
guess_maxage = 100
guess_minage = 1 while guess_age != goal_age: if guess_age < goal_age: # 判断输入的数字是否正确
print()
if guess_age > guess_minage: # 用来取输入后的最小值
guess_minage = guess_age
print("your input number is:", guess_age)
print("that's too small... please guess ", guess_minage, "- ", guess_maxage, "!!")
elif guess_age > goal_age:
print()
if guess_age < guess_maxage: # 用来取输入后的最大值
guess_maxage = guess_age
print("your input number is:", guess_age)
print("that's too big... please guess ", guess_minage, " -", guess_maxage, "!!") guess_age = input("you can input 'give up' go to out or guess again:") if guess_age == "give up":
print("It's so pity!!!")
break guess_age = int(guess_age) else:
print("you got it")

2.输出1-100之间的偶数

 #输入1-100之间的偶数

 No=1

 while No<=100:
if No%2==0:
print(No)
No+=1

3.语法1:break 用来跳出本循环,continue用来结束本次循环。

语法2:print(“abc”,end=“”) “abc”后面不换行,继续显示打印的内容。

 语法3:while ... else... 非break中止的程序,都会执行else后的程序 。

课堂笔记2019.4.19

编写九九乘法表

 '''
个人思路:
九九乘法表。 a=1 while a <= 9: b=1 while b<=a:print((b,”*”,a,b*a),end(“,”)) b+=1 a+=1
''' high =1 while high<=9:
wieth=1
while wieth<=high:
print(wieth,"*",high,"=",wieth*high,end="\t") # '\n'是换行,'\t'是tab
wieth+=1
print()
high+=1

自学python的日记分享的更多相关文章

  1. 420小时学习代码之后:如何教你免费自学Python

    原文地址:learning-to-code-420-hours-later-how-to-teach-yourself-python-for-free 说明:有些网址需要FQ. 大约在1.5年前,我开 ...

  2. 你是如何自学 Python 的?

    作为一名Python爱好者,我也想跟大家分享分享我自学Python的一些小经验.搬来你的小板凳,听听看吧.也许,你会很有收获,也许你也走上了自学Python的不归路.开讲啦~ 首先,你要有自信心,要明 ...

  3. 孤荷凌寒自学python第八十六天对selenium模块进行较详细的了解

    孤荷凌寒自学python第八十六天对selenium模块进行较详细的了解 (今天由于文中所阐述的原因没有进行屏幕录屏,见谅) 为了能够使用selenium模块进行真正的操作,今天主要大范围搜索资料进行 ...

  4. 孤荷凌寒自学python第八十五天配置selenium并进行模拟浏览器操作1

    孤荷凌寒自学python第八十五天配置selenium并进行模拟浏览器操作1 (完整学习过程屏幕记录视频地址在文末) 要模拟进行浏览器操作,只用requests是不行的,因此今天了解到有专门的解决方案 ...

  5. 孤荷凌寒自学python第八十四天搭建jTessBoxEditor来训练tesseract模块

    孤荷凌寒自学python第八十四天搭建jTessBoxEditor来训练tesseract模块 (完整学习过程屏幕记录视频地址在文末) 由于本身tesseract模块针对普通的验证码图片的识别率并不高 ...

  6. 孤荷凌寒自学python第八十三天初次接触ocr配置tesseract环境

    孤荷凌寒自学python第八十三天初次接触ocr配置tesseract环境 (完整学习过程屏幕记录视频地址在文末) 学习Python我肯定不会错过图片文字的识别,当然更重要的是简单的验证码识别了,今天 ...

  7. 孤荷凌寒自学python第八十二天学习爬取图片2

    孤荷凌寒自学python第八十二天学习爬取图片2 (完整学习过程屏幕记录视频地址在文末) 今天在昨天基本尝试成功的基础上,继续完善了文字和图片的同时爬取并存放在word文档中. 一.我准备爬取一个有文 ...

  8. 孤荷凌寒自学python第八十一天学习爬取图片1

    孤荷凌寒自学python第八十一天学习爬取图片1 (完整学习过程屏幕记录视频地址在文末) 通过前面十天的学习,我已经基本了解了通过requests模块来与网站服务器进行交互的方法,也知道了Beauti ...

  9. 孤荷凌寒自学python第八十天开始写Python的第一个爬虫10

    孤荷凌寒自学python第八十天开始写Python的第一个爬虫10 (完整学习过程屏幕记录视频地址在文末) 原计划今天应当可以解决读取所有页的目录并转而取出所有新闻的功能,不过由于学习时间不够,只是进 ...

随机推荐

  1. maven入门 (二)_私服安装与上传下载

    本篇文章主要介绍maven的私服安装和 jar包的上传与下载.毕竟大家还是在公司需要上传jar包到自己公司私服的. 1.安装私服 下载链接: https://pan.baidu.com/s/17dbQ ...

  2. HttpClient 专题

    HttpClient is a HTTP/1.1 compliant HTTP agent implementation based on HttpCore. It also provides reu ...

  3. Android开发——子进程更新UI

    方式一:Handler和Message ① 实例化一个Handler并重写handlerMessage()方法 private Handler handler = newHandler() { pub ...

  4. 高德地图 地铁图adcode 城市代码

    北京 1100天津 1200石家庄 1301沈阳 2101大连 2102长春 2201哈尔滨 2301上海 3100南京 3201无锡 3202苏州 3205杭州 3301宁波 3302合肥 3401 ...

  5. instrument(2)

    学习了instrument之后试着自己写点东西,上一篇的例子中使用的是asm,毕竟是面向字节码的,api还是比较复杂的.其实有时候的需求很简单,无非就是看下类里的方法啊之类的.javassist是基于 ...

  6. BZOJ_1058_[ZJOI2007]报表统计_STL

    BZOJ_1058_[ZJOI2007]报表统计_STL Description 小Q的妈妈是一个出纳,经常需要做一些统计报表的工作.今天是妈妈的生日,小Q希望可以帮妈妈分担一些工 作,作为她的生日礼 ...

  7. BZOJ_4864_[BeiJing 2017 Wc]神秘物质_Splay

    BZOJ4864_[BeiJing 2017 Wc]神秘物质_Splay Description 21ZZ 年,冬. 小诚退休以后, 不知为何重新燃起了对物理学的兴趣. 他从研究所借了些实验仪器,整天 ...

  8. centos7中输入ifconfig出现ens33,没有eth0

    vmware安装的centos7中没有出现eth0网卡,也没有ip,不能上网,输入ifconfig后如下图 解决办法 1.编辑网卡的配置文件 vi /etc/sysconfig/network-scr ...

  9. TF.learn学习

    官网地址:https://www.tensorflow.org/versions/r1.1/get_started/tflearn 1.代码例子 实现自定义的Estimator 使用DNNClassi ...

  10. mybatis-generator自動逆向生成文件

    首先在maven里面添加插件 <plugins> <plugin> <groupId>org.mybatis.generator</groupId> & ...