I am new to Python 3 and am working on the "Breaking the Records" problem on Hackerrank. My code works properly in IDLE when I use strings for my input, but I don't know how to change Hackerrank's input into something "useable" like a string. I've had the same problem for basically every other Hackerrank exercise I've tried as well.
The problem says that for the input, "The first line contains an integer n denoting the number of games, and the second line contains n spaced-separated integers describing the respective values of s0, s1, ... s(n-1)"
Here is the code I've tried so far.
a = [int(x) for x in input().split()]
b = [int(x) for x in input().strip().split(' ')]
def results(a,b):
highest = b[0]
lowest = b[0]
highest_changes = 0
lowest_changes = 0
for i in range(1,len(b)):
if b[i] > b[i-1] and b[i] > highest:
highest = b[i]
highest_changes += 1
if b[i] < b[i-1] and b[i] < lowest:
lowest = b[i]
lowest_changes += 1
return highest_changes, lowest_changes