NP66. 增加元组的长度
描述
输入描述
无输出描述
Python 解法, 执行用时: 9ms, 内存消耗: 2856KB, 提交时间: 2022-08-01
mytuple=tuple(range(1,6)) youtuple=(6,7,8,9,10) combine=mytuple+youtuple print(mytuple) print(len(mytuple)) print(combine) print(len(combine))
Python 解法, 执行用时: 10ms, 内存消耗: 2848KB, 提交时间: 2022-08-04
# t1 = tuple(range(1, 6)) # print(t1) # print(len(t1)) # t2 = tuple(range(6, 11)) # t = t1 + t2 # print(t) # print(len(t)) t1 = (1, 2, 3, 4, 5) print(t1) print(len(t1)) t2 = (6, 7, 8, 9, 10) t = t1+t2 print(t) print(len(t))
Python 解法, 执行用时: 10ms, 内存消耗: 2992KB, 提交时间: 2022-08-05
t=tuple(range(1,6)) print(t) print(len(t)) t1=t+tuple(range(6,11)) print(t1) print(len(t1))
Python 3 解法, 执行用时: 27ms, 内存消耗: 4460KB, 提交时间: 2022-08-05
num_tuple = (1,2,3,4,5) print(num_tuple) print(len(num_tuple)) numb_tuple = (6,7,8,9,10) sum_tuple = num_tuple + numb_tuple print(sum_tuple) print(len(sum_tuple))
Python 3 解法, 执行用时: 27ms, 内存消耗: 4472KB, 提交时间: 2022-07-27
a = tuple(range(1, 6)) print(a) print(len(a)) b = tuple(range(6, 11)) c = a + b print(c) print(len(c))