Software engineering and personal development

Category: Science & Tech (Page 10 of 35)

How to Quickly Find the Symmetric Difference of 2 Sets in Python

low-angle photography of brown concrete building during daytime
Photo by Samuel-Elias Nadler on Unsplash

If you have to find the union of elements that are either in the first or the second set, but not in both of them, then you need to use the symmetric difference.

This is also another math operation between sets that you have probably seen in a math class in high school.

This can be done quite easily and quickly using 2 built-in methods in Python.

Let’s start with the first one.

Continue reading

How to do Multiple Prints in a Single Line in Python

printing machine
Photo by Bank Phrom on Unsplash

If you want to print multiple things in the same line, you do not need to clutter everything with the plus operator, or do some type of conversion and then do the concatenation.

For that, we are going to use the help of the “end” parameter inside the print() method indicating the type of separator that you want to use between the items that you want to print.

Continue reading
« Older posts Newer posts »

© 2024 Fatos Morina

Theme by Anders NorenUp ↑