:D my code is quite basic because I just started learning so I thought of using this table list here to do the score calculation. I wanted to make empty lists for each number and append the score based on the conditions, but I don't know how to check for the conditions I need to calculate the scores based on the placement of the numbers. These are the conditions for each number:
This is my current code: The 4x4 table I've printed out
I'm using this code to generate random numbers from the list and asking the user to place it.
num_list = ['1','2','3','4','5']
import random
num = random.choice(num_list)
table = [[' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ']]
ss = {"W1":[0,0],
"W2":[1,0],
"W3":[2,0],
"W4":[3,0],
"X1":[0,1],
"X2":[1,1],
"X3":[2,1],
"X4":[3,1],
"Y1":[0,2],
"Y2":[1,2],
"Y3":[2,2],
"Y4":[3,2],
"Z1":[0,3],
"Z2":[1,3],
"Z3":[2,3],
"Z4":[3,3]}
ans = input('where would you like to place it: ')
index_ = ss[ans][0]
columns_ = ss[ans][1]
table[index_][columns_] = num
print(table)
Aucun commentaire:
Enregistrer un commentaire