So I'm a python beginner and don't really know the gist of random functions. The following is my code (but only partially so it may not make sense but it has the point of what I wanted to ask. I put the conclusion of my code on the beginning of the paragraph after the code though. P.S. the code works):
if (1 <= numb_quiz <= 100):
from openpyxl import Workbook, load_workbook
book = load_workbook('Quiz_Problems.xlsx')
read_sheet = book['100 Questions']
length_row = read_sheet.max_row
sheet = book.active
numb_question = 1
point = 0
engagement = 0
correct = 0
while numb_question <= numb_quiz:
randrow = random.randint(2, length_row)
for row in read_sheet.iter_rows(randrow, randrow, min_col = 2, max_col = 2):
print("")
print("Question number", str(numb_question) + ":")
print([cell.value for cell in row])
for col in read_sheet.iter_rows(min_row = randrow, max_row = randrow, min_col = 3, max_col = 3):
print([cell.value for cell in col])
break
guest_answer = str(input("answer: "))
answer = str("D"+str(randrow))
correct_ans = sheet[answer].value
As you can see, to conclude what I wanted to do with the code above is to print random rows in column 3 with the random function from xslx file using python. The thing is, I wanted to prevent the random function to print the row from column 3 more than once in one run. Since again, I don't really understand what the 'import random' library can actually do, perhaps there is a way to get what I wanted. Does anyone have a solution? thank you so much
P.S. Since I'm a python beginner, I also would fancy an explanation from you (so not just the code. thank you!)