1.制作一个像1元云购这样的元支app多少钱
2.求一元二次方程JAvascript
3.说说 Python çå
ç¼ç¨
制作一个像1元云购这样的app多少钱
无论是怎么样的软件,都是付源有bug的,所以网络上承诺的码元木马股黄牛指标源码功能很强的,都不可能帮你解决所以问题,支付所以大部分是元支源码资源的网站不断的修改源码,处理各类bug,付源远程遥控小车源码增加个性化的码元木马功能,因此除非你自己懂技术,支付或者有技术合作伙伴,元支否则你会很麻烦,付源另外现在的码元木马云购支付也是在打擦边球,以后会不会整顿还不知道。支付最后说一下本人做云购这套系统,元支长线资金指标源码包括原生安卓和ios app已经将近2年,付源也不敢保证给别人装一套系统一劳永逸。码元木马扫菲系统源码
求一元二次方程JAvascript
以下是全部的源代码,经过火狐3.和IE7测试,绝对符合你的要求
<html>
<head>
<script type="text/javascript">
function jisuan(){
var a=parseInt(document.getElementById("a").value);
var b=parseInt(document.getElementById("b").value);
var c=parseInt(document.getElementById("c").value);
var x1=document.getElementById("x1");
var x2=document.getElementById("x2");
var inf=document.getElementById("inf");
inf.value="小提示:此方程的解应经求出";
var xx1=(-b-Math.pow(b*b-4*a*c,0.5))/(2*a);
var xx2=(-b+Math.pow(b*b-4*a*c,0.5))/(2*a);
x1.value="x1= "+xx1;x2.value="x2= "+xx2;
if(x1.value=="x1= NaN"){ inf.value="小提示:此方程无解";}
if(a+b+c!=a+b+c){ inf.value="小提示:a,b,c只能是数字";}
}
</script>
</head>
<body>
<form>
<input id="a" type="text" value="a" size="3"/>x*x+
<input id="b" type="text" value="b" size="3"/>x+
<input id="c" type="text" value="c" size="3"/>=0<br/><br/>
<input id="do" type="button" value="解" onclick="jisuan()"/>
<input id="x1" type="text" value="x1=" size=""/>
<input id="x2" type="text" value="x2=" size=""/><br/><br/>
<input id="inf" type="text" value="小提示:请分别填入a,b,c的值" size=""/>
<input type="reset" value="清除"/>
</form>
</body>
</html>
说说 Python çå ç¼ç¨
æå°å è¿ä¸ªåï¼ä½ ä¹è®¸ä¼æ³å°å æ°æ®ï¼å æ°æ®å°±æ¯æè¿°æ°æ®æ¬èº«çæ°æ®ï¼å 类就æ¯ç±»çç±»ï¼ç¸åºçå ç¼ç¨å°±æ¯æ述代ç æ¬èº«ç代ç ï¼å ç¼ç¨å°±æ¯å ³äºå建æä½æºä»£ç (æ¯å¦ä¿®æ¹ãçææå è£ åæ¥ç代ç )çå½æ°åç±»ã主è¦ææ¯æ¯ä½¿ç¨è£ 饰å¨ãå ç±»ãæ述符类ãæ¬æç主è¦ç®çæ¯å大家ä»ç»è¿äºå ç¼ç¨ææ¯ï¼å¹¶ä¸ç»åºå®ä¾æ¥æ¼ç¤ºå®ä»¬æ¯ææ ·å®å¶åæºä»£ç çè¡ä¸ºã
è£ é¥°å¨ è£ é¥°å¨å°±æ¯å½æ°çå½æ°ï¼å®æ¥åä¸ä¸ªå½æ°ä½ä¸ºåæ°å¹¶è¿åä¸ä¸ªæ°çå½æ°ï¼å¨ä¸æ¹ååæ¥å½æ°ä»£ç çæ åµä¸ä¸ºå ¶å¢å æ°çåè½ï¼æ¯å¦æ常ç¨ç计æ¶è£ 饰å¨ï¼
from functools import wrapsdef timeit(logger=None):"""èæ¶ç»è®¡è£ 饰å¨ï¼åä½æ¯ç§ï¼ä¿ç 4 ä½å°æ°"""def decorator(func):@wraps(func)def wrapper(*args, **kwargs):start = time.time()result = func(*args, **kwargs)end = time.time()if logger:logger.info(f"{ func.__name__} cost { end - start :.4f} seconds")else:print(f"{ func.__name__} cost { end - start :.4f} seconds")return resultreturn wrapperreturn decorator(注ï¼æ¯å¦ä¸é¢ä½¿ç¨ @wraps(func) 注解æ¯å¾éè¦çï¼ å®è½ä¿çåå§å½æ°çå æ°æ®) åªéè¦å¨åæ¥çå½æ°ä¸é¢å ä¸ @timeit() å³å¯ä¸ºå ¶å¢å æ°çåè½ï¼
@timeit()def test_timeit():time.sleep(1)test_timeit()#test_timeit cost 1. secondsä¸é¢ç代ç è·ä¸é¢è¿æ ·åçæææ¯ä¸æ ·çï¼
test_timeit = timeit(test_timeit)test_timeit()è£ é¥°å¨çæ§è¡é¡ºåº å½æå¤ä¸ªè£ 饰å¨çæ¶åï¼ä»ä»¬çè°ç¨é¡ºåºæ¯æä¹æ ·çï¼
åå¦æè¿æ ·ç代ç ï¼è¯·é®æ¯å æå° Decorator1 è¿æ¯ Decorator2 ?
from functools import wrapsdef decorator1(func):@wraps(func)def wrapper(*args, **kwargs):print('Decorator 1')return func(*args, **kwargs)return wrapperdef decorator2(func):@wraps(func)def wrapper(*args, **kwargs):print('Decorator 2')return func(*args, **kwargs)return wrapper@decorator1@decorator2def add(x, y):return x + yadd(1,2)# Decorator 1# Decorator 2åçè¿ä¸ªé®é¢ä¹åï¼æå ç»ä½ æ个形象çæ¯å»ï¼è£ 饰å¨å°±åå½æ°å¨ç©¿è¡£æï¼ç¦»å®æè¿çæå ç©¿ï¼ç¦»å¾è¿çæåç©¿ï¼ä¸ä¾ä¸ decorator1 æ¯å¤å¥ï¼decorator2 æ¯å è¡£ã
add = decorator1(decorator2(add))
å¨è°ç¨å½æ°çæ¶åï¼å°±åè±è¡£æï¼å 解é¤æå¤é¢ç decorator1ï¼ä¹å°±æ¯å æå° Decorator1ï¼æ§è¡å° return func(
args, kwargs) çæ¶åä¼å»è§£é¤ decorator2ï¼ç¶åæå° Decorator2ï¼å次æ§è¡å° return func(
args, kwargs) æ¶ä¼çæ£æ§è¡ add() å½æ°ã
éè¦æ³¨æçæ¯æå°çä½ç½®ï¼å¦ææå°å符串ç代ç ä½äºè°ç¨å½æ°ä¹åï¼åä¸é¢è¿æ ·ï¼é£è¾åºçç»ææ£å¥½ç¸åï¼
def decorator1(func):@wraps(func)def wrapper(*args, **kwargs):result = func(*args, **kwargs)print('Decorator 1')return resultreturn wrapperdef decorator2(func):@wraps(func)def wrapper(*args, **kwargs):result = func(*args, **kwargs)print('Decorator 2')return resultreturn wrapperè£ é¥°å¨ä¸ä» å¯ä»¥å®ä¹ä¸ºå½æ°ï¼ä¹å¯ä»¥å®ä¹ä¸ºç±»ï¼åªè¦ä½ ç¡®ä¿å®å®ç°äº__call__() å __get__() æ¹æ³ã
å ç±» Python ä¸ææç±»ï¼objectï¼çå ç±»ï¼å°±æ¯ type ç±»ï¼ä¹å°±æ¯è¯´ Python ç±»çå建è¡ä¸ºç±é»è®¤ç type ç±»æ§å¶ï¼æ个æ¯å»ï¼type ç±»æ¯ææç±»çç¥å ãæ们å¯ä»¥éè¿ç¼ç¨çæ¹å¼æ¥å®ç°èªå®ä¹çä¸äºå¯¹è±¡å建è¡ä¸ºã
å®ä¸ä¸ªç±»ç»§æ¿ type ç±» Aï¼ç¶åè®©å ¶ä»ç±»çå ç±»æå Aï¼å°±å¯ä»¥æ§å¶ A çå建è¡ä¸ºãå ¸åçå°±æ¯ä½¿ç¨å ç±»å®ç°ä¸ä¸ªåä¾ï¼
class Singleton(type):def __init__(self, *args, **kwargs):self._instance = Nonesuper().__init__(*args, **kwargs)def __call__(self, *args, **kwargs):if self._instance is None:self._instance = super().__call__(*args, **kwargs)return self._instanceelse:return self._instanceclass Spam(metaclass=Singleton):def __init__(self):print("Spam!!!")å ç±» Singleton ç__init__å__new__ æ¹æ³ä¼å¨å®ä¹ Spam çæé´è¢«æ§è¡ï¼è __call__æ¹æ³ä¼å¨å®ä¾å Spam çæ¶åæ§è¡ã
descriptor ç±»ï¼æ述符类ï¼
descriptor å°±æ¯ä»»ä½ä¸ä¸ªå®ä¹äº __get__()ï¼__set__()æ __delete__()ç对象ï¼æè¿°å¨è®©å¯¹è±¡è½å¤èªå®ä¹å±æ§æ¥æ¾ãåå¨åå é¤çæä½ãè¿é举å®æ¹ææ¡£[1]ä¸ä¸ªèªå®ä¹éªè¯å¨çä¾åã
å®ä¹éªè¯å¨ç±»ï¼å®æ¯ä¸ä¸ªæ述符类ï¼åæ¶è¿æ¯ä¸ä¸ªæ½è±¡ç±»ï¼
from abc import ABC, abstractmethodclass Validator(ABC):def __set_name__(self, owner, name):self.private_name = '_' + namedef __get__(self, obj, objtype=None):return getattr(obj, self.private_name)def __set__(self, obj, value):self.validate(value)setattr(obj, self.private_name, value)@abstractmethoddef validate(self, value):passèªå®ä¹éªè¯å¨éè¦ä» Validator 继æ¿ï¼å¹¶ä¸å¿ é¡»æä¾ validate() æ¹æ³ä»¥æ ¹æ®éè¦æµè¯åç§çº¦æã
è¿æ¯ä¸ä¸ªå®ç¨çæ°æ®éªè¯å·¥å ·ï¼
OneOf éªè¯å¼æ¯ä¸ç»å约æçé项ä¹ä¸ã
class OneOf(Validator):def __init__(self, *options):self.options = set(options)def validate(self, value):if value not in self.options:raise ValueError(f'Expected { value!r} to be one of { self.options!r}')Number éªè¯å¼æ¯å¦ä¸º int æ floatãæ ¹æ®å¯éåæ°ï¼å®è¿å¯ä»¥éªè¯å¼å¨ç»å®çæå°å¼ææ大å¼ä¹é´ã
class Number(Validator):def __init__(self, minvalue=None, maxvalue=None):self.minvalue = minvalueself.maxvalue = maxvaluedef validate(self, value):if not isinstance(value, (int, float)):raise TypeError(f'Expected { value!r} to be an int or float')if self.minvalue is not None and value < self.minvalue:raise ValueError(f'Expected { value!r} to be at least { self.minvalue!r}')if self.maxvalue is not None and value > self.maxvalue:raise ValueError(f'Expected { value!r} to be no more than { self.maxvalue!r}')String éªè¯å¼æ¯å¦ä¸º strãæ ¹æ®å¯éåæ°ï¼å®å¯ä»¥éªè¯ç»å®çæå°ææ大é¿åº¦ãå®è¿å¯ä»¥éªè¯ç¨æ·å®ä¹ç predicateã
class String(Validator):def __init__(self, minsize=None, maxsize=None, predicate=None):self.minsize = minsizeself.maxsize = maxsizeself.predicate = predicatedef validate(self, value):if not isinstance(value, str):raise TypeError(f'Expected { value!r} to be an str')if self.minsize is not None and len(value) < self.minsize:raise ValueError(f'Expected { value!r} to be no smaller than { self.minsize!r}')if self.maxsize is not None and len(value) > self.maxsize:raise ValueError(f'Expected { value!r} to be no bigger than { self.maxsize!r}')if self.predicate is not None and not self.predicate(value):raise ValueError(f'Expected { self.predicate} to be true for { value!r}')å®é åºç¨æ¶è¿æ ·åï¼
@timeit()def test_timeit():time.sleep(1)test_timeit()#test_timeit cost 1. seconds0æè¿°å¨é»æ¢æ æå®ä¾çå建ï¼
@timeit()def test_timeit():time.sleep(1)test_timeit()#test_timeit cost 1. seconds1æåçè¯ å ³äº Python çå ç¼ç¨ï¼æ»ç»å¦ä¸ï¼
å¦æå¸ææäºå½æ°æ¥æç¸åçåè½ï¼å¸æä¸æ¹ååæçè°ç¨æ¹å¼ãä¸åéå¤ä»£ç ãæç»´æ¤ï¼å¯ä»¥ä½¿ç¨è£ 饰å¨æ¥å®ç°ã
å¦æå¸ææä¸äºç±»æ¥ææäºç¸åçç¹æ§ï¼æè å¨ç±»å®ä¹å®ç°å¯¹å ¶çæ§å¶ï¼æ们å¯ä»¥èªå®ä¹ä¸ä¸ªå ç±»ï¼ç¶å让å®ç±»çå ç±»æå该类ã
å¦æå¸æå®ä¾çå±æ§æ¥ææäºå ±åçç¹ç¹ï¼å°±å¯ä»¥èªå®ä¹ä¸ä¸ªæ述符类ã
以ä¸å°±æ¯æ¬æ¬¡å享çææå 容ï¼å¦æä½ è§å¾æç« è¿ä¸éï¼æ¬¢è¿å ³æ³¨å ¬ä¼å·ï¼Pythonç¼ç¨å¦ä¹ åï¼æ¯æ¥å¹²è´§å享ï¼å 容è¦çPythonçµå书ãæç¨ãæ°æ®åºç¼ç¨ãDjangoï¼ç¬è«ï¼äºè®¡ç®ççãææ¯åå¾ç¼ç¨å¦ä¹ ç½ï¼äºè§£æ´å¤ç¼ç¨ææ¯ç¥è¯ã
åæï¼/post/