剛剛看了紀錄,很可怕的是我七月份都沒有任何一次更新,
這意味者我七月份整個月整個忙翻了Q__Q
除了每天加班加爆之外,事情還又趕又急,
好吧,大概就是這樣。
這一次的題目,其實是出給內部同仁練習的題目,
算簡單,不難,所以就想說分享看看,
That's all.
( 解答在最下面 )
=============================================================================================================================
1. Please design three function to implement the following output.
[1.1]------------------------
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
[1.2]------------------------
*
* *
* * *
* * * *
* * * * *
[1.3]------------------------
* * * * *
* * * *
* * *
* *
*
------------------------
=============================================================================================================================
2. Please use this function to output the result.
'''
break & continue
'''
def XXX():
for i in range(1, 10):
....
....
....
output:
1
2
3
hello
5
hello
7
=============================================================================================================================
3. Please design a function to implement a filter repeat string.
EX:
input : abcde = "abcdaaddccddeeabacd"
output: abcde = "abcde"
"""
set->list->sort->"".join
"""
=============================================================================================================================
4.please design a class to implement the following output.
input:
X = [1,3,5,7]
X = [1,1,1,1,1]
X = [0,8,9,5,7,6]
output:
X = [1,4,9,16]
X = [1, 2, 3, 4, 5]
X = [0, 8, 17, 22, 29, 35]
Explanation:
X = [1,1+3,1+3+5,1+3+5+7]
X = [1,1+1,1+1+1,1+1+1+1,1+1+1+1+1]
X = [0,0+8,0+8+9+,0+8+9+5,0+8+9+5+7,0+8+9+5+7+6]
class Solution(object):
def RUN_RUN_RUN(self, nums):
----------------
----------------
----------------
return ?
def main():
#please invoke RUN_RUN_RUN function to implement your ans.
1.
for i in range(5):
print("* "*5)
print("------------------------")
for i in range (5):
print("* " *(i+1))
print("------------------------")
for i in range(5,0,-1):
print("* " *(i))
2.
def XXX():
for i in range(1, 10):
if i == 4 or i == 6:
print("hello")
continue
if i == 8:
break;
print(i)
3
def main():
abcde = "abcdaaddccddeeabacd"
result = set(abc)
print(result)
result = list(result)
print(result)
result.sort(reverse=False)
res="".join(result)
print(res)
4.
class Solution(object):
def RUN_RUN_RUN(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
x = 0
for i in range (len(nums)):
x += nums[i]
nums[i] = x
return nums
def main():
X = [0,8,9,5,7,6]
res = Solution()
print(res.RUN_RUN_RUN(X))
留言列表