Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Insert a sequence of same numbers, unpacking
#python 3.5.2 def get_nums(n, freq): l = [n] * freq return l # TEST CASE 1 ELEV = [1.2, 3.2, *get_nums(0.0, 2) ,3.9, *get_nums(0.0, 3)] print(ELEV) print() # newline # TEST CASE 2 arr = [45, *get_nums(1, 4), *get_nums(9, 3), 34, 99, *get_nums(7, 1), 12, 21, *get_nums(-1, 5)] print(arr)
run
|
edit
|
history
|
help
0
Guessing game
list of primes
Add missing person on list with default age 30
single inheritance
Student
Принцип наименьшего времени Ферма
Brother's share
PyRegLookBehind
Atur cara mengira luas permukaan dan isipadu sebuah trapezium
calculate the sum of string 201test70de88qa ( only numbers)