python每日一函数 - divmod数字处理函数 divmod(a,b)函数 中文说明: divmod(a,b)方法返回的是a//b(除法取整)以及a对b的余数 返回结果类型为tuple 参数: a,b可以为数字(包括复数) 版本: 在python2.3版本之前不允许处理复数,这个大家要注意一下 英文说明: Take two (non complex) numbers as arguments and return a pair of numbers consisting of their
练习1 2019-3-19# 写一个函数实现99乘法表 def x99(x): if x >=1 and x <=9: line = 1 while line <= x: start=1 while start <= line: print('{0}*{1}={2}'.format(start,line,start*line),end=' ') start+=1 print() line+=1 else: print('参数在1-9的正整数范围内!') # 调用函数 x99(9)练
class slice(stop)class slice(start, stop[, step]) Return a slice object representing the set of indices specified by range(start, stop, step). The start and step arguments default to None. Slice objects have read-only data attributes start, stop and
os与sys模块的官方解释如下: os: This module provides a portable way of using operating system dependent functionality. 这个模块提供了一种方便的使用操作系统函数的方法. sys: This module provides access to some variables used or maintained by the interpreter and to functions that intera