mardi 21 juin 2022

How can I print all possible answers in python?

There are 7 questions with 4 choices ( A, B, C, D). I want to log or print all possible answers. For example

> A A A A A A A
  A A A A A A B
  A A A A A A C
  A A A A A A D
  B A A A A A A
  B A A A A A B
  B A A A A A C
  .
  .
  .
  .
  .
  .
  D D D D D D D

How can I print it?

I've tried the following

for a in range(7):
    for b in range(7):
        for c in range(7):
            for d in range(7):
                print(a, b, c, d)

But this outputs

> 1 1 1 1
  1 1 1 2
  1 1 1 3
  1 1 1 4
  . 
  . 
  .
  6 6 6 6

But i need to get 7 possible answers to be printed on each line.




Aucun commentaire:

Enregistrer un commentaire