自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 《MATLAB实用教程》第四章:符号运算——符号变生成、符号变量的基本操作

符号生成用sym函数生成一个符号或符号表达式用syms函数定义一个符号或符号表达式sym函数一次只能定义一个符号变量,而syms可定义多个。syms a b c d;w = 10;x = 5;y = -8;z = 11;A = [a,b;c,d]B = [w,x;y,z]det(A)det(B)>>A =[ a, b][ c, d] B = 10 5 -8 11ans =a*d - b*cans = 150·.

2020-05-12 23:19:46 1707

原创 《MATLAB实用教程》第二章:MATLAB数据结构——字符串、单元型变量、结构体变量

字符串的连接s1 = "we should study hard"s2 = "and we should never forget out country"w = [s1, s2]>> w = "we should study hard and we should never forget out country"MATLAB可以实现实现字符串的垂直连接,但是需要...

2020-04-14 16:40:13 1096

原创 《MATLAB实用教程》第一章:MATLAB基础——文件操作

文件的打开和关闭打开文件filename = fopen("文件名","打开方式")file = fopen("matlab.mat","w+")>>file = 3关闭文件sta = fclose(filename)>>sta = 0二进制文件的读写操作写二进制文件COUNT = fwrite(filename, A,...

2020-03-24 16:24:42 442

原创 《MATLAB实用教程》第一章:MATLAB基础——基本使用方法

简单数学运算注意“不等于”是 ~=逻辑运算中,所有非零数值被认为“True”,零为“False”。逻辑运算结果中,结果为“True”,输出1,否则为0复数a = 1+3i标点符号使用常用操作命令和快捷键disp()b = (1:2:10)>>b = 1 3 5 7 9 disp(b)>> 1 3 5 7 9 #与上...

2020-03-24 11:52:20 319 1

原创 《MATLAB实用教程》第二章:MATLAB数据结构——数组和矩阵

好久没更新了,正好学校要学MATLAB,就顺便更新一波吧,装作有人看的样子。数组寻址A = [1,2,3,4,5, 6]A(5) = 5A(2:4) = 2 3 4A(1:2:6) = 1 3 5A(4:end) = 4 5 6A[1,4,6] = 1 4 6a(31:end) = b数组合并a = [1, 23, 43, 21, 45, 67]b = [23...

2020-03-20 11:25:38 358

原创 《Python编程:从入门到实践》Pygame创建窗口实践

12-1import pygamedef main(): pygame.init() screen = pygame.display.set_mode((900, 600)) bg_color = (0, 0, 255) while True: screen.fill(bg_color) pygame.display.fl...

2020-01-29 12:17:14 202

原创 《Python编程:从入门到实践》数据存储实践

10-11import jsonnumber = input("Please enter your favorite number:")filename = "favourite number.json"with open(filename, "r") as f: json.dump(number, f)import jsonwith open('favour...

2020-01-03 16:24:25 140

原创 《Python编程:从入门到实践》异常处理实践

10-6try: a = input("Enter the first number:") b = input("Enter the second number:") int(a) + int(b)except ValueError: print("Please enter a number.")else: print(a + " + " + ...

2019-12-23 19:48:58 114

原创 《Python编程:从入门到实践》文件写入实践

10-3user_name = input("Enter your guest user name:")with open('guest.txt','a') as file_object: file_object.write(user_name + "\n")10-4with open('guest_book.txt','a') as file_obj: a...

2019-12-22 17:04:36 186

原创 《Python编程:从入门到实践》读取文件实践

10-1with open('learning_python.txt') as file_object: content = file_object.read() print(content) for line in file_object: print(line) lines = file_object.readlines()pri...

2019-12-22 12:40:47 102

原创 《Python编程:从入门到实践》导入类实践

9-13from collections import OrderedDictwords = OrderedDict()words['list'] = '列表'words['if'] = '判断'words['else'] = '判断'words['elif'] = '判断'words['for'] = '循环'for word, mean in words.items...

2019-11-23 05:27:45 106

原创 《Python编程:从入门到实践》类的继承实践

类的继承:子类的方法_int_()、定义子类的属性和方法、重写父类的方法、将实例用作属性、模拟实物

2019-11-11 04:26:11 111

原创 《Python编程:从入门到实践》class(类)修改实践

class Restaurant(): def __init__(self,name,cuisine):#初始化 self.name = name self.type = cuisine self.number_reserved = 0 def describle_restaurant(self):#描述餐厅 pri...

2019-11-04 03:33:01 213

原创 《Python编程:从入门到实践》定义class(类)实践

9-1class Restaurant(): def __init__(self,name,cuisine):#初始化 self.name = name self.type = cuisine def describle_restaurant(self):#描述餐厅 print(self.name.title() + " i...

2019-10-24 07:01:47 138

原创 《Python编程:从入门到实践》任意数量实参实践

8-12def make_sandwhich(*ingredients): print("\nMaking sandwhich with the following ingredients:") for ingredient in ingredients: print("- " + ingredient.title())make_sandwhich('...

2019-10-14 12:57:09 120

原创 《Python编程:从入门到实践》函数编辑列表实践

8-9def show_magicians(names): for name in names: print(name.title())names = ["sam","bob","tim"]show_magicians(names)8-10def make_great(names): for i in range(len(names)): ...

2019-10-14 12:06:56 83

原创 《Python编程:从入门到实践》return实践

8-6def city_country(city,country): city_country = '"' + city.title() +", " + country.title() + '"' return city_countryshanghai = city_country("shanghai","china")print(shanghai)new_york = ...

2019-10-14 11:56:14 109

原创 《Python编程:从入门到实践》传递参数实践

8-3#位置实参def make_shirts(size,words): print("The size of the shirt is " + size) print("The words on it are " + words)make_shirts("L","Just do it.")#关键字实参def make_T_shirts(size,words): ...

2019-10-02 07:26:23 100

原创 《Python编程:从入门到实践》定义函数实践

8-1def display_message(): print("I learnt while loop.")display_message()8-2def favourite_book(book_name): print("One of my favorite book is " + book_name)favourite_book("Three Body")

2019-10-01 05:59:18 88

原创 《Python编程:从入门到实践》while循环处理列表和字典实践

7-8sandwich_orders = ["tuna","ham","beef"]finished_sandwiches = []for sandwich in sandwich_orders: print("I made you " + sandwich + " sandwich.")while sandwich_orders: sandwich = sandwich...

2019-09-30 08:08:41 134

原创 《Python编程:从入门到实践》while循环实践

7-4active = Truewhile active: topping = input("请输入一种配料: ") if topping != "无": print("我们会在披萨中加" + topping) else: active = False7-5active = Truewhile active: age =...

2019-09-29 08:58:06 136

原创 《Python编程:从入门到实践》用户输入实践

7-1car = input("What kind of car do you want to drive? ")print("Let me see if I can find you a " + car)7-2customers = input("How many customers will come? ")if int(customers) > 8: print(...

2019-09-29 07:56:29 102

原创 《Python编程:从入门到实践》字典嵌套实践

6-7Sunjichen = { "first_name" : "Sun", "last_name" : "jichen", "city" : "Dezhou", "age" : "19", }Lihanpeng = { "first_name" : "Hanpeng", "last_name" : "Li", "city" :...

2019-09-29 01:45:04 123

原创 《Python编程:从入门到实践》字典遍历实践

6-4words = { 'list' : '列表', 'if' : '判断', 'elif' : '判断', 'else' : '判断', 'for' : '循环', 'sorted' : '按字母顺序排序语句', 'sort()' : '安字母排序方法', 'upper()' : '全部大写', 'lower()' ...

2019-09-27 05:30:42 95

原创 《Python编程:从入门到实践》字典编辑实践

6-1Sunjichen = { "first_name" : "Sun", "last_name" : "jichen", "city" : "Dezhou", "age" : "19", }print(Sunjichen)6-2numbers = { 'sunjichen' : '9', 'lihanpeng' : '8',...

2019-09-27 04:46:14 107

原创 《Python编程:从入门到实践》if语句处理列表实践

5-8import random as rdusers = ['admin','Sia','S_young','Ryan','Bob']user_login = users[rd.randint(0,5)]if user_login == 'admin': print("Hello admin, would you like to see a status report?")...

2019-09-10 22:57:05 81

原创 《Python编程:从入门到实践》if、elif、else 实践

5-3#通过alien_color = "green"if alien_color == "green" : print("You got 5 points!")#未通过alien_color = "red"if alien_color == "green": pass5-4#版本1alien_color = "green"if alien_color =...

2019-09-10 21:06:02 77

原创 《Python编程:从入门到实践》检查条件实践

tank = "M1A2"print("tank == M1A2 ? I predict True")print(tank == "M1A2")print("tank == Type-99 ? I predict False")print(tank == "Type-99")print("\n")user_name = "Sia"print(user_name == "sia")...

2019-09-09 20:23:48 62

原创 《Python编程:从入门到实践》元组实践

menu = ("鱼香肉丝","西红柿炒鸡蛋","老醋花生","宫保鸡丁","醋溜白菜")for dish in menu : print(dish)#menu[2] = "糖醋里脊"menu = ("鱼香肉丝","西红柿炒鸡蛋","老醋花生","尻鸭","京酱肉丝")for dish in menu: print(dish)...

2019-09-09 19:41:57 129

原创 《Python编程:从入门到实践》列表切片实践

4-10省略4-11my_pizzas = ["cheese","saussage","beef"]friend_pizzas = my_pizzas[:]my_pizzas.append("yogurt")friend_pizzas.append("shit")print("My favourite pizza are : " )for pizza in my_pizzas: ...

2019-09-08 21:39:17 94

原创 《Python编程:从入门到实践》rang()循环实践

实践4-3和4-4省略4-5million = [value for value in range(1,10000001)]print(min(million))print(max(million))print(sum(million))4-6odd_number = [number for number in range(1,21,2)]print(odd_number)...

2019-09-08 20:52:30 137

原创 《Python编程:从入门到实践》for循环实践

pizzas = ["cheese","saussage","beef"]for pizza in pizzas : print("I love " + pizza + "\n")print("I really love pizza")"\n"pets = ("husky","French bulldog","golden retriever")for pet in pets ...

2019-09-08 20:13:53 131

原创 《Python编程:从入门到实践》列表顺序实践

places = ["newyork","shenzhen","beijing","chongqing","paris"]print(places) '''原始顺序'''print(sorted(places)) '''sorted()按字母顺序打印'''print(sorted(places,reverse=True)) '''字母顺序相反'''print(plac...

2019-09-07 11:04:35 122

原创 《Python编程:从入门到实践》列表增删元素实践

list = ["sam","tom","mike","paul"]print(list.pop(0))list.append("ela")print(list)print("A blgger table is found.")list.insert(0,"sia")list.insert(2,"ryan")list.append("hipp")print(list.title...

2019-09-06 21:28:25 246

空空如也

空空如也

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

TA关注的人

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