![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
Janlay884181317
这个作者很懒,什么都没留下…
展开
-
Python入门实例---------猜数字
功能介绍:1.随机生成数字2.猜中一次积分+13.没猜中保留当前随机数继续猜,直到猜中重置随机数源码:import random;coin=0;randomInt = random.randint(0, 5);flag=False;print("猜数字游戏");while flag==False: print("---------------------");原创 2018-01-27 21:01:03 · 292 阅读 · 1 评论 -
用Python解释“面向对象”和“面向过程”的区别
假设我们有一辆汽车,我们知道它的速度(60km/h),以及A、B两地的距离(100km)。要算出开着这辆车从A地到B地花费的时间。面向过程的方法:speed = 60.0distance = 100.0time = distance / speedprint time面向对象的方法:class Car: speed = 0 def drive(self转载 2018-01-28 22:54:51 · 1614 阅读 · 0 评论