Aug-08-2021, 10:40 AM
here is one way
#! /usr/bin/env python3 x = [[2, 4, 6], [1, 3, 5], [7, 8, 9]] for inner_list in x: for num in range(0, len(inner_list)): if inner_list[num] % 2 != 0: inner_list[num] = inner_list[num] + 1 print(x)
Output:[[2, 4, 6], [2, 4, 6], [8, 8, 10]]
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags