I'm trying to learn how I can convert Python list comprehensions to a normal for-loop. I have been trying to understand it from the pages on the net, however when I'm trying myself, I can't seem to get it to work.
What I am trying to convert is the following:
1:
n, m = [int(i) for i in inp_lst[0].split()]
and this one (which is a little bit harder):
2:
lst = [[int(x) for x in lst] for lst in nested[1:]]
However, I am having no luck with it.
What I have tried:
1:
n = []
for i in inp_lst[0].split():
n.append(int(i))
print(n)
If I can get some help, I will really appreciate it :D