Question: import random def ask _ position _ question ( ) : planet = random.choice ( planets ) position = planets.index ( planet ) + 3

import random
def ask_position_question():
planet = random.choice(planets)
position = planets.index(planet)+3
user_response = input(f"What is the position of {planet}, relative to the Sun?
")
if user_response.isdigit() and int(user_response)== position:
print(f"That is correct.
{planet} is planet number {position} from the Sun.")
else:
user_guess = input(f"That is not correct.
{planet} is planet number {position} from the Sun.")
user_guess = input("What is the name of the "+ str(position +3)+"th planet from the sun? ")
if user_guess == planet:
print("That is correct. Next question, BRO")
else:
print("That is not correct. Next question.")
ask_position_question()import random
def ask_position_question():
planet = random.choice(planets)
position = planets.index(planet)+3
user_response = input(f"What is the position of {planet}, relative to the Sun?
")
if user_response.isdigit() and int(user_response)== position:
print(f"That is correct.
{planet} is planet number {position} from the Sun.")
else:
user_guess = input(f"That is not correct.
{planet} is planet number {position} from the Sun.")
user_guess = input("What is the name of the "+ str(position +3)+"th planet from the sun? ")
if user_guess == planet:
print("That is correct. Next question, BRO")
else:
print("That is not correct. Next question.")
ask_position_question()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!