自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 收藏
  • 关注

原创 《笨办法学python》36-40if/符号/列表/字典/类

习题36:设计和调试if语句的规则:每一个"if语句"必须包含一个else。如果这个else永远都不应该被执行到,因为它本身没有任何意义,那你必须在else语句后面使用一个叫做die的函数,让它打印出错误信息。"if语句"的嵌套不要超过2层,最好尽量保持只有1层。将"if语句"当做段落来对待,其中的每一个if,elif,else组合就跟一个段落的句子组合一样。在这种组合的最前面和最后面留一个空行以作区分你的布尔测试应该很简单,如果它们很复杂的话,你需要将它们的运算事先放到一个变量里,并且为

2021-05-26 08:36:50 134

原创 《笨办法学python》习题31-35

习题31:作出决定代码print("""You enter a dark room with two doors.Do you go through door #1 or door #2?""")door = input(">")if door == "1": print("There's a giant bear here eating a cheese cake.") print("What do you da?") print("1.Take the cak

2021-05-20 23:02:23 239

原创 《笨办法学python》习题26-30

习题26:恭喜你,现在可以考试了下载链接:https://learnrubythehardway.org/book/exercise26.txt代码先贴上错误的代码吧 # This function will break up words for us. def Ex25.brak_words(stuff) words = stuff.split(' ') return word end # Sorts the words. def Ex25.sortwords(

2021-05-19 21:41:53 226

原创 《笨办法学python》习题21-25

def add(a,b): print(f"Adding {a} + {b}") return a+bdef subtract(a,b): print(f"Substracting {a} - {b}") return a-bdef multiply(a,b): print(f"multiplying {a} * {b}") return a*bdef divide(a,b): print(f"dividing {a}/{b}") ret

2021-05-17 23:48:41 229

原创 笨方法学python16-20

习题16:读写文件代码这部分根据搜索eval以及input内容,自己加多了一点小练习。熟悉一下evalprint("How old are you?",end="")age = input()print("How tal are you?",end="")height = input()print("How much do you weigh?",end="")weight = input()print(f"So,you're {age} old,{height} tall and {we

2021-05-16 14:48:43 155

原创 笨方法学python11-15

习题11:提问代码这部分根据搜索eval以及input内容,自己加多了一点小练习。熟悉一下evalprint("How old are you?",end="")age = input()print("How tal are you?",end="")height = input()print("How much do you weigh?",end="")weight = input()print(f"So,you're {age} old,{height} tall and {weig

2021-05-14 23:24:02 188

原创 笨方法学python6-10

习题6:字符串和文本作者提示:1.尝试破坏代码 然后自己去修复

2021-05-11 23:32:53 210

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除