Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up:Could you do it without any
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up: Could you do it without an
table中有一个字段,id,它是由Yunsha_000001的规则组成的. 每当插入一条数据的时候,自动生成的id是自动增加的,如何实现数字部分的自动增长? select 'Yunsha_'||lpad(substr(nvl(max(id),'Yunsha_000000'),8)+1,6,'0') as maxid from table
if 后面跟的是条件表达式,条件表达式的结果为True或者False. (1)如果if后面的条件是数字,只要这个数字不是0,python都会把它当做True处理,见下面的例子: if 3: print 'OK' 输出OK,但是如果数字是0,就会被认为是False. (2)如果if后面跟的是字符串,则只要这个字符串不为空串,python就把它看作True,参见下例 if 'hehe': print 'No problem'