[Solved] How to hide a value in Python? (display it as a *) [closed]


This should be enough code to get you started. You just need a flag to determine whether a number should be hidden or not:

grid = [
  [{"number": 1, "hidden": True}, {"number": 5, "hidden": False}, {"number": 8, "hidden": True}],
  [{"number": 3, "hidden": True}, {"number": 2, "hidden": True}, {"number": 4, "hidden": False}],
  [{"number": 9, "hidden": True}, {"number": 7, "hidden": False}, {"number": 3, "hidden": False}]
]

for row in grid:
  for column in row:
      print("*" if column["hidden"] else column["number"], "", end="")
  print()

Prints:

* 5 * 
* * 4 
* 7 3 

solved How to hide a value in Python? (display it as a *) [closed]