![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
脚本
Black Spur
这个作者很懒,什么都没留下…
展开
-
matlab实现双骰子游戏
写一个蒙特卡罗模拟判定双骰子游戏获胜几率,function f=double_shai()times=zeros(1,2);n=100000;for i=1:n num1=fix(6*rand)+1; num2=fix(6*rand)+1; sumtwo1=num1+num2; if (sumtwo1 == 7 || sumtwo1 == 11) ...原创 2019-11-20 13:52:15 · 3260 阅读 · 0 评论 -
matalab-----蒙特卡洛方法模拟蒙提霍尔问题
利用matlab,写一个蒙特卡洛模拟验证蒙提霍尔概率问题:function f = mentihuoer()win_times=zeros(1,2);car_box_id=fix(3*rand)+1;n=100000;for i=1:n chose_id=fix(3*rand)+1; if chose_id == car_box_id win_times(...原创 2019-11-20 10:30:54 · 667 阅读 · 0 评论 -
python实现注册登录
利用python实现简单的注册登录:#注册import jsondef register(): with open('user_db.json', 'r', encoding='utf-8')as f: user_data = json.load(f) user_list = {} print('please register new user')...原创 2019-08-19 13:51:40 · 635 阅读 · 0 评论 -
python实现添加商品至购物车
利用python简单实现选择商品列表里的商品,并添加至购物车,计算总价格:def shopping(): global shopping_list print('shopping_list is showing:') for i in range(len(shopping_list)): key = str(i + 1) print(key...原创 2019-08-19 15:15:32 · 2259 阅读 · 0 评论 -
python 实现计算器功能
开发一个简单的python计算器实现加减乘除及拓号优先级解析用户输入 1 - 2 * ( (60-30 +(-40/5) * (9-25/3 + 7 /399/42998 +10 * 568/14 )) - (-43)/ (16-32) )等类似公式后,必须自己解析里面的(),+,-,,/符号和公式(不能调用eval等类似功能偷懒实现),运算后得出结果,结果必须与真实的计算器所得出的结果一致...原创 2019-09-03 22:56:39 · 559 阅读 · 0 评论 -
python创建选课系统-----01.实现学校、课程、学生及班级角色创建
首先实现各个角色的创建,同时将各角色的相关联属性连系起来,详细请看代码:#后期保存合格对象的数据集合school_list = []course_list = {}class_list = {}teacher_list = {}student_list = []class School(object): """ 创建学校 """ def __in...原创 2019-09-11 11:09:27 · 1085 阅读 · 0 评论 -
python创建选课系统-----02.实现管理员视图
管理视图:创建讲师, 创建班级,创建课程,详情请见代码:from school_system import *catalogue = { '1': 'create_teacher', '2': 'create_class', '3': 'create_course',}def create_teacher(school): id_num = input...原创 2019-09-12 11:14:39 · 203 阅读 · 0 评论