'Converting a list of elements to asteriks
How do I convert a list of elements to asterisks?
def converter (input):
int_to_list = [(x) for x in str(input)]
if len(int_to_list) == 16:
first_12_digit = int_to_list[0 : 12]
list_to_int_1 = ''.join(first_12_digit)
print(list_to_int_1)
last_4_digit = int_to_list[12 : 16]
list_to_int_2 = ''.join(last_4_digit)
print(list_to_int_2)
I am trying to convert all of the elements of the list first_12_digit to asterisks, an example output will be ["*","*","*","*".....]. Is there a way to do it using list comprehension?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
