python - How to loop through a 2d list/tuple in a certain order and user input? -
i want make 2d list/tuple , loop through user input, mean advance 1 "block" of list/tuple when user gives input to.
like:
1 4 7
2 5 8
3 6 9
so start in 1 default program should ask user input advance or not advance through list , display contained section.
when last number reached (in case 9) go beginning , keep going indefinitely.
i have thinking how hours , reached conclusion programming knowledge pretty basic solve on own... sadly.
i'm beginner after all.
i have tried many things scratched everything, not seeing here.
a while
loop , counter work problem:
s = [[1, 4, 7], [2, 5, 8], [3, 6, 9]] answer = "y" count = 0 while answer == "y": if count == len(s): count = 0 in s[count]: print(i) answer = input("do want continue?")[0].lower() count += 1
Comments
Post a Comment