- 博客(25)
- 资源 (1)
- 收藏
- 关注
原创 幂级数框架
本内容的参考书目:陈纪修《数学分析》(下册)https://u.jd.com/mJWpJL幂级数幂级数是最简单的函数项级数,具有很好的性质. 以下是关于幂级数的基本框架.收敛半径R会使用柯西判别法和d’Alembert判别法确定收敛半径RRR.柯西判别法d’Alembert判别法Cauchy-Hadamard定理Abel定理Cauchy-Hadamard定理和Abel定理反...
2020-04-01 23:46:42 436
原创 Python学习笔记一
书籍Python编程入门到实践京东:https://u.jd.com/mxYv6z变量message = "Hello Python World"print(message) # 打印messagemessage是变量,讲字符型(string)‘Hello Python World’ 赋值给message ,然后使用print() 函数打印变message.变量命名规则:...
2020-03-24 11:09:25 107
原创 笨方法学Python 习题42
#!usr/bin/python3# -*- coding:utf8 -*-## Animal is-a object (yea, sort of confusing) look at the extra creditclass Animal(object): # 定义动物 pass## ? is-aclass Dog(Animal): # 定义狗,隶属于动物 def...
2018-10-20 10:19:29 553
原创 Python 面向对象
面向对象编程—Object Oriented Programming, 简称OOP, 是一种程序设计思想。OOP把对象作为程序的基本单元,一个对象可以是数据,也可以是操作数据的函数。面向过程的程序设计把计算机程序视为一系列的命令集合,即一组函数的顺序执行。为了简化程序设计,面向过程把函数继续切分为子函数,即把大块函数通过切割成小块函数来降低系统的复杂度。而面向对象的程序设计把计算机程序视为一组...
2018-10-09 17:11:15 147
原创 笨方法学Python 习题40
字典mystuff = {'apple': "I AM APPLE!"}调用print("mystuff['apple'])模块def apple(): print("I AM APPLE!")#另一个变量tangerine = "Living reflection of a dream"保存为 mys
2018-10-04 20:55:17 347 2
原创 笨方法学Python 习题39
字典、可爱的字典# create a mapping of state to abbreviationstates = { 'Oregon': 'OR', 'Florida': 'FL', 'California': 'CA', 'New York': 'NY', 'Michigan': 'MI'}# create a basic set of...
2018-10-02 13:40:53 241
原创 Python中 format 的功法
format 的用法print('{名字} 今天 {动作}.'.format(名字 = '王同学',动作 = '拍视频')) # 利用关键字grade = {'名字': '王同学', '分数': '59'} # 字典print('{名字} 电工考了 {分数}.'.format(**grade)) # 利用关键字 + 字典print('{1} 今天 {0}'.format('拍视频','王同...
2018-10-01 22:24:59 184
原创 笨方法学Python 习题37
使用Python 获取帮助查看关键字在终端运行 help 命令help("keywords")help("open")help("def")del 的用法# 查看关键字# 在终端运行 help 命令# help("keywords")# help("open")# help("def")# 新命令 delA = ['a','b','c','d','e','f'
2018-10-01 17:23:19 120
原创 笨方法学Python 习题38
ten_things = "Apples Oranges Crows Telephone Light Sugar"print("Wait there's not 10 things in that list, let's fix that.")stuff = ten_things.split(' ') # 讲 ten_things 的元素分开, 并将分开之后的元素创建成 数组more_s...
2018-09-30 23:57:26 191
原创 笨方法学Python 习题35
#!usr/bin/python3# -*- coding:utf8 -*-from sys import exitdef gold_room(): print("The room is full of gold. How much do you take?") next = input('> ') if '0' in next or '1' in next...
2018-09-29 20:59:11 430
原创 笨方法学Python 习题33
#!usr/bin/python3# -*- coding:utf8 -*-i = 0numbers = []while i < 6: print("At the top i is {0}".format(i)) numbers.append(i) i = i+1 print("Numbers now: ", numbers)
2018-09-29 19:44:10 163
原创 笨方法学Python 习题32
#!usr/bin/python3# -*- coding:utf8 -*-the_count = [1,2,3,4,5]fruits = ['apples','oranges','pears','apricots']change = [1,'pennies',2,'dimes',3,'quarters']# this first kind of for-loop goes thro...
2018-09-29 19:21:15 144
原创 笨方法学Python 习题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. What do you do?"...
2018-09-28 10:10:10 101
原创 笨方法学Python 习题30
people = 30cars = 40buses = 15if cars > people: print("We should take the cars.")elif cars < people: print("We should not take the cars.")else: print("We can't decide.")if bu...
2018-09-28 09:45:55 166
原创 笨方法学Python 习题29
people = 20cats = 30dogs = 15if people < cats: print("To many cats! The world is doomed!")if people > cats: print("Not to many cats! The world is saved!")if people < dogs: ...
2018-09-28 09:08:51 107
原创 笨方法学Python 习题25
def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return wordsdef sort_words(words): """Sorts the words.""" return sorted(words
2018-09-27 16:35:47 435
原创 笨方法学Python 习题24
print("Let's practice everything.")print('You\'d need to know \'about escapes with \\ that do \n newline and \t tabs.')poem = """\t The lovely worldwith logic so firmly plantedcannot discern \n...
2018-09-26 22:40:26 142
原创 笨方法学Python 习题21
函数可以返回某些变量def add(a,b): print("Adding {0} + {1}".format(a,b)) return(a+b)def subtract(a,b): print("SUBTRACT {0} - {1}".format(a,b)) return(a-b)def multiply(a,b): print("MULTIP...
2018-09-24 16:35:58 298
原创 笨方法学Python 习题 20
from sys import argv # 依然调用 argvscript, file_name = argv # 解包变量 argvdef print_all(f): # 定义函数。 print(f.read()) # 函数功能:打印文本内容。def rewind(f): # 定义函数。 f.seek(0) # 函数功能:回到文本的初始位置def print_...
2018-09-24 15:39:41 468
原创 笨方法学Python 习题19
def cheese_and_crackers(cheese_count, boxes_of_crackers): print(&quot;You have {0} cheeses!&quot;.format(cheese_count)) print(&quot;You have {0} boxes of crackers!&quot;.format(boxes_of_crackers)) print(&quot;Man
2018-09-23 23:12:47 166
原创 笨方法学Python 习题18
命名、变量、代码和函数# this one is like your script with argvdef print_two(*argv): arg1,arg2 = argv print("arg1: {0}; arg2: {1}".format(arg1,arg2)) # arg1,arg2 都是局部变量;不是全局变量# 单独定义的变量才是全局变量# OK, this *a...
2018-09-23 22:59:03 164
原创 Python 文本的处理
先open, 并赋值给一个中间变量(当然这个中间变量可以省略).对中间变量进行操作,操作的结果对原来文本依然有效.举例: 将 from_file. txt 复制到 to_file. txt 中借助中间变量from sys import argvscript, from_file, to_file = argvin_file = open(from_file) # 打开 from...
2018-09-22 20:43:06 362
原创 笨方法学Python 习题15
from sys import argv #引入argvscript, filename = argvtxt = open(filename) #打开文本文件print(&quot;Here's your file %r:&quot; % filename)print(txt.read())print(&quot;Type the filename again:&quot;)file_again = input('&a
2018-09-22 08:40:49 208
原创 笨方法学Python 习题16
笨方法学Python 习题16from sys import argvscript, filename = argvprint(&amp;amp;quot;We're going to erease {0}.&amp;amp;quot;.format(filename))print(&amp;amp;quot;If you don't want that, hit CTRL-C (^C).&amp;amp;quot;)print(
2018-09-21 14:34:41 151
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人