#πŸ”’ noob question but i really struggle with this lmao

30 messages Β· Page 1 of 1 (latest)

lethal condor
#
setm = set()
for _ in range(m):
    setm.add(map(int, input().split()))

n = int(input()) 
setn = set()
for _ in range(n):
    setn.add(map(int, input().split()))

symdiff = setn.symmetric_difference(setm)
sortdiff = sorted(symdiff)

for num in sortdiff:
    print(num) ```

i actually cant find the error within this code 😭 also does anyone have a resource for learning other than leetcode and forums?
zenith daggerBOT
#

@lethal condor

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

steep jewel
#

it is supposed to map tuples or integers

lavish cave
#

set.add should take a single value.

#

use set.update instead

#

or set |= other

#
m = int(input())
setm = set()
for _ in range(m):
    setm.update(map(int, input().split()))

n = int(input()) 
setn = set()
for _ in range(n):
    setn.update(map(int, input().split()))

symdiff = setn.symmetric_difference(setm)
sortdiff = sorted(symdiff)

for num in sortdiff:
    print(num)
lethal condor
#

it still says this tho πŸ˜”

#

Traceback (most recent call last):
File "Solution.py", line 4, in <module>
EOFError

#

what does that even mean πŸ’€

lavish cave
#

How are you running it?

#

EOFError means it reached the end of the file before it read anything

#

!e input()

zenith daggerBOT
# lavish cave !e input()

:x: Your 3.12 eval job has completed with return code 1.

:warning: Note: input is not supported by the bot :warning:

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     input()
004 | EOFError: EOF when reading a line
lavish cave
#

python bot doesn't attach stdin, so it can't read it

#

That looks familiar, right?

lethal condor
#

ohhhh yeah

#

so how can i fix it?

lavish cave
#

How are you running it?

#

Running python in a terminal will always attach stdin

lethal condor
#

uhhh im running it on some kind of training website

#

it works on vscode tho

lavish cave
#

Then it probably doesn't give you a terminal.

lethal condor
#

is there even any fix to that?

lavish cave
#

probably not.

#

see if there's an FAQ about this on your website

lethal condor
#

alright, thank you for the help

zenith daggerBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.