Check for non-overlapping values with Python tea sets.

Asked 2 years ago, Updated 2 years ago, 78 views

Hi, everyone. I am a beginner among beginners who have only started studying Python by myself for about a month. I was making a program because I thought of one

Enter the values in the first and second text widgets in the two text widgets as shown in the picture Let's print out the only non-overlapping value in the third text widget I searched a lot and tried it, but it didn't go well, so I went to this place for the first time Let's raise the question.

First, you have to write a code to find a set of differences between the two lists with a for statement or set and enter only one digit Saving was successful. But the problem here is that the values I'm entering are not single digits, but are mixed with numbers and English characters (e.g. JK01200666555 )
And when I typed it in the text widget and printed it out, Python recognizes J, K, 0, 1, 2... It seems like they recognize it as an element one by one like this way.

JK01200666555 Is there a way to make it recognized as one element? Let me ask you a question. And that's how the code for finding a differential set in two text widgets is perceived Should I squeeze it? I'd appreciate your advice. Or if there's a good code that doesn't overlap even if it's not a differential set, I'd appreciate it if you could recommend it ^

^

python duplicate code list text

2022-09-20 15:38

1 Answers

code1 = ['JK01200666555', 'cK01200666555']
code2 = ['JK01200666555', 'dK01200666555']

result = set(code1) -set(code2)
print(result)

I think you can use the list like this.


2022-09-20 15:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.