#pythonsyntax — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #pythonsyntax, aggregated by home.social.
-
### Enclosed generator expressions in Python.
x0 = [0, 1, 2]
x1 = [x for x in x0]assert type(x0) == list
assert type(x1) == listy0 = {0, 1, 2}
y1 = {y for y in y0}assert type(y0) == set
assert type(y1) == setz0 = (0, 1, 2)
z1 = (z for z in z0)assert type(z0) == tuple
assert type(z1) != tuple #Caveat programmator.## Oh, did you mean:
z2 = tuple(z for z in z0)
assert type(z2) == tuple -
Hello everyone.
In today's article, we examine the Python snytax structure in detail.
https://denizhalil.com/2024/10/19/python-syntax-guide-beginners/
#python #pythonprogramming #programing #pythontutorial #pythonroadmap #pythonsyntax