What is the result of the following code when initiated?
brilliant = 1000
other = 100
if brilliant > other:
result = "b"
elif other > brilliant:
result = "o"
if result == "b":
winner = "b"
elif result == "o":
winner = "o"
if winner == "b":
print("Brilliant!")
elif winner == "o":
print("Not Brilliant!")
Do not run this code to find the answer
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
This code means: If the number brilliant is assigned to is greater than the other number (if 1000 is greater than 100) set result to 'b'. Otherwise set result to 'o'. If result is 'b', set winner to 'b'. Otherwise, set winner to 'o'. If winner is 'b', say: Brilliant!. Otherwise, say: Not Brilliant! The result will be: Brilliant! You can test this in the 'coding environment' above the 'log-out' option.