avatar Bite 293. N digit numbers

Write a function that accepts a list of numbers and converts them into n digit integers.

Examples:  

n_digit_numbers([1, 2, 3], 2)  => [10, 20, 30]

n_digit_numbers([8, 9, 10], 2)  => [80, 90, 10]

n_digit_numbers([-1.1, 2.22, -3.333], 3)  => [-110, 220, -333]

Note: Negative numbers should keep their negativity and calling the function with n < 1 should raise a ValueError.

 

Login and get coding
go back Beginner level
Bitecoin 2X

35 out of 41 users completed this Bite.
Will you be Pythonista #36 to crack this Bite?
Resolution time: ~52 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 5.33 on a 1-10 difficulty scale.
» Up for a challenge? 💪

We use Python 3.8