Created
August 15, 2022 14:56
-
-
Save Mark-McCracken/5583df706ba8c68e20c750a83320e14c to your computer and use it in GitHub Desktop.
def_create_worded_round.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_worded_round(round_number): | |
round_name = ROUNDS[round_number - 1] | |
questions = [ | |
{"question": pair[0].value, "answer": pair[1].value} | |
for pair in book.worksheets[round_number - 1]['A2':'B11'] | |
if pair[0].value is not None and pair[1].value is not None | |
] | |
assert len(questions) == 10, f"Round {round_number} called {round_name} does not have 10 questions" | |
round_intro_slide = prs.slides.add_slide(slide_layouts.get_by_name("ROUND_ANNOUNCEMENT")) | |
round_intro_slide.placeholders[10].text = f"{round_name} ROUND" | |
general_knowledge_slide = prs.slides.add_slide(slide_layouts.get_by_name("WORDED_QUESTIONS")) | |
general_knowledge_slide.placeholders[22].text = f"{round_name} QUESTIONS" | |
for idx, pair in enumerate(questions): | |
general_knowledge_slide.placeholders[idx+33].text = f"{idx+1}. {pair['question']}" | |
round_intro_slide = prs.slides.add_slide(slide_layouts.get_by_name("ROUND_ANNOUNCEMENT")) | |
round_intro_slide.placeholders[10].text = f"{round_name} ANSWERS" | |
for idx, pair in enumerate(questions): | |
answer_slide = prs.slides.add_slide(slide_layouts.get_by_name("ROUND_ANSWER")) | |
answer_slide.placeholders[22].text = f"{round_name} ANSWERS" | |
answer_slide.placeholders[10].text = f"{idx+1}. {pair['question']}" | |
answer_slide.placeholders[23].text = f"{idx+1}. {pair['answer']}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment