笨办法学习python 学习笔记习题26
笨办法学习python 学习笔记习题26
修改后如下:
print("你多大了?", end=' ')
age = input()
print("你多高?", end=' ')
height = input()
print("你多重?", end=' ')
weight = input()print(f"你的 {age} 身高, {height} 体重 {weight} .")
from sys import argv
script, filename = argvtxt = open(filename,encoding='utf-8')print(f"这是你的文件 {filename}:")
print(txt.read())print("再键入文件名:")
file_again = input("> ")txt_again = open(file_again,encoding='utf-8')print(txt_again.read())print("让我们实践的一切.")
print('''You\'d need to know \'bout escapeswith \\ that do \n newlines and \t tabs.''')poem = """
\tThe lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend passion from intuition
and requires an explanation
\n\t\twhere there is none.
"""print("--------------")
print(poem)
print("--------------")five = 10 - 2 + 3
print(f"应该是5: {five}")def secret_formula(started):jelly_beans = started * 500jars = jelly_beans / 1000crates = jars + 100return jelly_beans, jars, cratesstart_point = 10000
beans, jars, crates = secret_formula(start_point)
# remember that this is another way to format a string
print("With a starting point of: {}".format(start_point))
# it's just like with an f"" string
print(f"We'd have {beans} beans, {jars} jars, and {crates} crates.")start_point = start_point / 10print("We can also do that this way:")
formula = secret_formula(start_point)
# this is an easy way to apply a list to a format string
print("We'd have {} beans, {} jars, and {} crates.".format(*formula))people = 20
cates = 30
dogs = 15if people < cates:print( "太多的猫!世界末日")if people < cates:print("猫不是很多!世界得救了!")if people < dogs:print("全世界都在垂涎!!")if people > dogs:print("世界是干燥的!")dogs += 5if people >= dogs:print("人大于或等于狗.")if people <= dogs:print("人不如狗.")if people == dogs:print("人是狗.")
笨办法学习python 学习笔记习题26相关推荐
- 【读书笔记】Python编程-基础知识和案例讲解,“笨办法”学Python 3_2020.02.15
[概述] --书名:"笨办法"学Python 3 --作者:泽德 A.肖 --日期:2020年02月15日 --大事件记录: 截至2月14日24时,据31个省(自治区.直辖市)和新 ...
- 笔记14 笨办法中折磨人的习题ex23.py,人类语言与计算机语言
笔记14 笨办法中折磨人的习题ex23.py,人类语言与计算机语言 开始学习习题23了,但为了那个languages.text的下载,费了老大劲好像还是没有下载全.后来载下来了,那个代码文件录下来,却 ...
- 《“笨办法”学Python(第3版)》——习题3 数字和数学计算
本节书摘来自异步社区<"笨办法"学Python(第3版)>一书中的习题3,作者[美]Zed A. Shaw,王巍巍 译,更多章节内容可以访问云栖社区"异步社区 ...
- 这本 Python 入门畅销书《“笨办法”学 Python 3》,不仅仅是一本书!
在我们学习任何一门语言的时候,我们都恨不得有一本书或者有一节视频就能让我们学会所有内容,或者购买的书籍里能包含练习题,带着练习学习的话会更好的理解内容,Python编程语言的话题热度目前来看一直居高不 ...
- “笨办法”学Python 3基础篇-文件操作
"笨办法"学Python 3基础篇系列文章 "笨办法"学Python 3基础篇 第一部分-打印与输入 "笨办法"学Python 3基础篇 第 ...
- 笨办法学python 粗略笔记(learn python the hard way)
笨办法学python 粗略笔记(learn python the hard way) 标签(空格分隔): python # _*_ coding: utf_8 _*_ ''' ### ex1 prin ...
- “笨办法”学Python 3基础篇 - 函数
"笨办法"学Python 3基础篇系列文章 "笨办法"学Python 3基础篇 第一部分-打印与输入 "笨办法"学Python 3基础篇 第 ...
- 笨办法学Python——学习笔记1
最近想学gtk,但是gtk在window上编译和运行挺慢的,于是搜索了一下发现了pygtk.在前几天 把环境都配好了,现在想同时学gtk和pygtk,但Python没学过,找到了<笨办法 ...
- [python教程入门学习]python学习笔记(CMD执行文件并传入参数)
本文章向大家介绍python学习笔记(CMD执行文件并传入参数),主要包括python学习笔记(CMD执行文件并传入参数)使用实例.应用技巧.基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋 ...
最新文章
- ((ios开发学习笔记 十一))自定义TableViewCell 的方式实现自定义TableView(带源码)...
- ABAP--如何快速从BSEG读取数据
- tcga数据下载_TCGA数据下载(mRNA)
- excel打开空白_PDF转成Excel后,打开表格却是空白的?
- python 局域网 主机名_使用python获取连接到本地网络(基于主机名)的所有设备的ip...
- java i/o 流详解_java I/O流详解
- MATLAB在运筹学背包问题的应用,运筹学论文之二维背包问题.docx
- linux .run文件_Linux快捷键及目录结构
- iOS 编写高质量Objective-C代码(五)
- 南阳oj-----一种排序(优先队列法)
- php sjis,【通译】PHP中文字编码变换时使用SJIS-win而非SJIS,使用eucJP-win而非EUC-JP...
- PROXMOX 开源虚拟服务器系统安装及配置
- 循环switch 变量x 如果case a 车辆型号查询系统官网,车辆型号怎么去查询?
- Word2016任意页开始设置页码
- Unity零基础入门 - 打砖块(Unity 2017)
- 筋膜枪方案-无刷马达方波运用1
- 新冠时空分析——Global evidence of expressed sentiment alterations during the COVID-19 pandemic
- laravel5.4中orm中的wherein与多条件查询
- 常见测试场景用例设计(1):登录页面测试用例
- U盘什么格式最好?U盘格式介绍