weight

py06_05-1:案例之小明爱跑步

我只是一个虾纸丫 提交于 2020-03-23 09:58:06
class Person: def __init__(self,name,weight): self.name = name self.weight = weight def __str__(self): return '我叫%s,我的体重是%.2f' % (self.name, self.weight) # %f,保留小数,2f指保留两位小数 def run(self): self.weight -= 0.5 def eat(self): self.weight += 1 xiaoming = Person('小明',75) xiaoming.run() xiaoming.eat() print(xiaoming) 来源: https://www.cnblogs.com/yeyu1314/p/12550306.html

python08面向对象(封装)

余生颓废 提交于 2020-03-15 13:55:34
一、使用方法,封装变量. 1 # 使用方法,封装变量. 2 class Wife: 3 def __init__(self, name, age, weight): 4 self.name = name 5 # 本质:障眼法(实际将变量名改为:_类名__age) 6 # self.__age = age 7 self.set_age(age) 8 # self.__weight = weight 9 self.set_weight(weight) 10 11 # 提供公开的读写方法 12 def get_age(self): 13 return self.__age 14 15 def set_age(self, value): 16 if 21 <= value <= 31: 17 self.__age = value 18 else: 19 raise ValueError("我不要") 20 21 # 提供公开的读写方法 22 def get_weight(self): 23 return self.__weight 24 25 def set_weight(self, value): 26 if 40 <= value <= 60: 27 self.__weight = value 28 else: 29 raise ValueError("我不要") 30 31 """

nginx反向代理

不羁岁月 提交于 2020-03-03 06:14:46
user nginx; worker_processes auto; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; upstream www { server 192.168.1.125:81 weight=1 max_fails=2 fail_timeout=3;  

map-apply-applymap

大兔子大兔子 提交于 2020-02-13 13:04:40
map-apply-applymap /*--> */ /*--> */ /*--> */ /*--> */ /*--> */ /*--> */ In [1]: import warnings import math import pandas as pd import numpy as np import matplotlib warnings.filterwarnings('ignore') pd.options.display.max_rows = 100 pd.options.display.max_columns = 100 pd.set_option('max_colwidth', 500) get_ipython().magic(u'matplotlib inline') matplotlib.style.use('ggplot') from matplotlib import pyplot as plt plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False myfont = matplotlib.font_manager.FontProperties(fname=u'simsun.ttc', size=14) In [11]: data = pd

C# Nginx平滑加权轮询算法

﹥>﹥吖頭↗ 提交于 2020-02-09 00:12:55
代码很简单,但算法很经典,话不多说,直接上代码。 public struct ServerConfig { /// <summary> /// 初始权重 /// </summary> public int Weight { get; set; } /// <summary> /// 当前权重 /// </summary> public int Current { get; set; } /// <summary> /// 服务名称 /// </summary> public string Name { get; set; } }    public static int NextServerIndex(ServerConfig[] ss) { int index = -1; int total = 0; int size = ss.Count(); for (int i = 0; i < size; i++) { ss[i].Current += ss[i].Weight; total += ss[i].Weight; if (index == -1 || ss[index].Current < ss[i].Current) { index = i; } } ss[index].Current -= total; return index; }    static void

Jpa规范之hibernate的一对一关联查询操作学习

北城以北 提交于 2020-01-28 04:00:55
我们搭建一个maven项目,然后我们加载数据,数据我已经准备好了。 -- truncate all delete from jpa_test . oo_t_idcard where 1 = 1 ; delete from jpa_test . oo_t_person where 1 = 1 ; -- oo_t_person INSERT INTO jpa_test . oo_t_person ( id , created_by , created_date , last_modified_by , last_modified_date , hair_color , height , weight ) VALUES ( 1 , 4 , '2019-12-12 02:55:14.786000000' , 4 , '2019-12-12 02:55:14.786000000' , 'green' , 62.00 , 75.00 ) ; INSERT INTO jpa_test . oo_t_person ( id , created_by , created_date , last_modified_by , last_modified_date , hair_color , height , weight ) VALUES ( 2 , 4 , '2019-12-12 02:55:14

c++继承与派生

五迷三道 提交于 2020-01-22 21:29:04
继承的作用是减少代码冗余,通过协调来减少接口和界面。 1.派生类的定义 <1>吸收基类成员 <2>改造基类成员 一是依靠派生类的继承方式来控制基类成员的访问、二是对基类成员或成员函数的覆盖。 <3>添加新的成员 2.类的继承方式 <1>.公有继承 #include <iostream> using namespace std; class vehicle { private: float weight; int wheels; public: vehicle(int in_wheels,float in_weight) { wheels=in_wheels; weight=in_weight; } int get_wheels() { return wheels; } float get_weight() { return weight; } }; class car:public vehicle { private: int passenger_load; public: car(int in_wheels,float in_weight,int people=5):vehicle(in_wheels,in_weight) { passenger_load=people; } int get_passenger() { return passenger_load; } };

————2020.1.18————

妖精的绣舞 提交于 2020-01-18 17:17:41
# 图 || Graph模板及实例化 # 图(Graph)数据结构本体。(Java) 1 package testAlgori; 2 3 import java.util.ArrayList; 4 import java.util.HashMap; 5 import java.util.HashSet; 6 7 public class Graph { 8 public HashMap<Integer, Node> nodes; 9 public HashSet<Edge> edges; 10 11 public Graph() { 12 nodes = new HashMap<>(); 13 edges = new HashSet<>(); 14 } 15 16 public static class Node { 17 public int value; 18 public int in; 19 public int out; 20 public ArrayList<Node> nexts; 21 public ArrayList<Edge> edges; 22 23 public Node(int value) { 24 this.value = value; 25 this.in = 0; 26 this.out = 0; 27 this.edges = new

拓扑排序算法

给你一囗甜甜゛ 提交于 2020-01-16 14:01:10
#include<stdio.h> #include<stdlib.h> #define MAXVEX 100 //最大顶点数 typedef char VertexType; //顶点 typedef int EdgeType; //权值 #define UNVISITED -1 //标记未访问 #define VISITED 1 //标记未访问 #define OK 1 #define ERROR 0 typedef int Status; typedef struct EdgeNode { int adjvex; //该顶点对应的下标 EdgeType weight; //权重 struct EdgeNode * next; }EdgeNode; typedef struct //顶点结构 { int in; //记录入度 VertexType data; EdgeNode * firstedge; }VertexNode,AdjList[MAXVEX]; typedef struct { AdjList adjList; int numVertexes; int numEdges; int Mark[MAXVEX]; //标记是否被访问过 }GraphAdjList; //图结构 //初始化邻接表 void InitGraphAdjList(GraphAdjList * G

uni-app 计算属性 computed

£可爱£侵袭症+ 提交于 2020-01-12 20:13:54
功能:=》大于1000用kg表示 小于1000,用g表示 计算属性 计算属性必须是有一个返回值的哦 在html写被计算的值 在computed中去直接调用哈 <view> <text>{{jisuweight}}</text> </view> data() { return { weight:1110, } }, computed:{ jisuweight(){ return this.weight>1000 ? (this.weight/1000)+"kg" : this.weight; } }, 来源: https://www.cnblogs.com/IwishIcould/p/12184430.html