How to take multiple input in a single line for tuple and list ?
a= list(x = int(input()) for x in range(n) if x > 0)
''' it has an error , how can I solve it and use similar code for tuple '''
How to take multiple input in a single line for tuple and list ?
a= list(x = int(input()) for x in range(n) if x > 0)
''' it has an error , how can I solve it and use similar code for tuple '''
Copyright © 2021 Jogjafile Inc.
You can use
filter
on your comprehension, like this:For
n = 5
and the input:it would print: