Why will this not work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why will this not work

import random def get_questions(): questionBank = [] questionBank.append(["how many steps are in the eiffel tower?", "1770", "10838"]) questionBank.append(["how many different flavours of gummy bears are there?", "4", "5"]) questionBank.append(["how many pizzas are eaten in the US per year?", "3 billion", "1,5 million"]) return questionBank def play_Quiz(): get_questions() = questions random.shuffle(questions) score = 0 for s in questions: print(s[0] + s[1] "or" s[2]) If you try to run it will say that it expected an indented block, someone help please

25th Dec 2019, 2:02 PM
Edward Johansson
Edward Johansson - avatar
2 Answers
+ 4
The error gives yoy everything you need. Line 24 is not indented. Therefore you need to tab line 24. Every line you want to be in a for loop must be indented one tab past its indent
25th Dec 2019, 2:08 PM
Jax
Jax - avatar
0
def play_Quiz(): # get_questions() = questions # flipped from original line above questions = get_questions() random.shuffle(questions) score = 0 for s in questions: # indent & use commas, not '+' print(s[0], s[1], "or", s[2]) play_Quiz() # need to call play_Quiz
25th Dec 2019, 2:45 PM
Ipang