1 / 2
Nov 2021

Hi,
I’m new to Spoj, I’ve been learning Python through the summer with online classes and now want go deeper, I don’t know why my code isn’t working though, I’ve been looking for ideas on the forum for an hour but now I think I need to ask for some help :slight_smile:

x : int
while True:
    x = input()
	if x != str(42):
		print(x)
	else:
		break
  • created

    Nov '21
  • last reply

    Nov '21
  • 1

    reply

  • 574

    views

  • 2

    users

  • 1

    link

In your test data, try adding some leading or trailing spaces, then find a way so that they don’t matter. e.g.

1
2
3
-4
5-
6
42
99

(Where - represents a space.)

I’m no Python expert, but what is x : int doing? According to this page7, Python has no command for declaring variables.