A Big Confusion !!


This is a companion discussion topic for the original entry at https://toph.co/p/a-big-confusion

I am always getting a runtime error in toph. but it works well on my computer IDE

Share your code bro. Let’s see your code!

reaction = [“Like”,“Haha”,“Sad”,“Love”,“Angry”]
for j in range(int(input())):
print()
temp3 = reaction[4]
temp1 = reaction[0]
temp2 = reaction[1]
reaction[4] = temp1
reaction[1] = temp3
reaction[0] = temp2
maximum = 0
max_number = 0
i = 0
while i < len(reaction):
print(reaction[i], end=" ")
ask_user = input()
if max_number == 0:
maximum = (str(reaction[i]))
max_number = int(ask_user)
elif int(ask_user) > max_number:
maximum = (str(reaction[i]))
max_number = int(ask_user)
i += 1
print("Case " + str(j + 1) + ": " + str(maximum))

I am doing this in python btw.

@anas_20101149 You got runtime error, because you didn’t take input properly. Read the question well.
The first line contains an integer T (1 ≤ T ≤ 100) indicating the number of test cases.

Each test case consists of five lines.

Each line will start with a string S, denoting the type of reaction (Like, Haha, Sad, Love, Angry) and its corresponding clicked value K (0 ≤ K ≤ 1000000).

Each testcases required five line. So, you have to take input like 5 time.
But you didn’t do it in your code. So, you got RE. You took input later in while loop. and before taking input you print a reaction.

It will be a great, if you share your code link! :slightly_smiling_face:

Ohhh now i get it. The contest ended but Thanks a lot.
I am quite new to Toph, where to get the code link ^^