Python_everyday (@python_facts_everyday)
- Followers
- 40 followers
- Following
- 1 following
- Likes
- 2.2K
- Videos
- 37
- Avg length
- 0:44
Latest videos by Python_everyday
-
– video
9 likes 0 comments 0 shares 1 save
In late 2023 Voyager 1, launched in 1977 and now over 24 billion km away, started sending home gibberish. One garbled reply turned out to be a readout of its whole memory, and it showed a single dead chip: about 3% of the flight computer's memory. With no single free space big enough, JPL…
-
– video
27 likes 0 comments 1 share 5 saves
In Belgium's 2003 election, a voting machine in Schaerbeek gave one candidate exactly 4,096 extra votes. Investigators found no fraud and no typo: 4,096 is 2^12, exactly one bit in memory flipped from 0 to 1, most likely by a particle from a cosmic-ray shower. In 2013 a Super Mario 64 speedrunner…
-
– video
4 likes 0 comments 0 shares 0 saves
Your computer can't flip a coin. Python's random runs a formula, and one starting number (the seed) decides every card. In 1999 a poker site seeded with the clock, and researchers who saw five cards knew every player's hand. See 624 outputs of Python's random and you can predict all the rest…
-
– video
5 likes 0 comments 0 shares 1 save
Delete both names and these two Python objects still won't die. Reference counts free most objects instantly, but a loop keeps each count at one, so the garbage collector hunts them down. #python #coding #programming #learnpython #cpython
-
– video
35 likes 1 comment 1 share 4 saves
Python doesn't run your file line by line. Press Run and the whole file is tokenised, parsed and compiled to bytecode first, then the CPython virtual machine runs that bytecode one instruction at a time. print("hi") alone becomes five instructions (LOAD_NAME, PUSH_NULL, LOAD_CONST, CALL, POP_TOP…
-
– video
45 likes 3 comments 3 shares 4 saves
Copy text from a web page and it can carry a zero-width space (U+200B): a real character that is zero pixels wide. Python counts it, so 'tiger' with one hidden inside has length 6 and doesn't equal 'tiger'. It's why a pasted password gets rejected, a search can't find a name that's right there…
-
– video
53 likes 0 comments 0 shares 9 saves
Sort text in Python and it doesn't count, it reads one character at a time: '10' comes before '2' because '1' comes before '2', and the rest is never read. Same reason photo10 jumps ahead of photo2 and invoice10 files before invoice2. Fixes: pad numbers with a zero (photo02), write dates year…
-
– video
63 likes 0 comments 4 shares 7 saves
len("👨👩👧👦") returns 7 in Python. That one family is four faces held together by three invisible zero width joiners (U+200D), and len counts code points, not what you see. Pull out the first joiner and Dad stands alone: the count drops to 6. Cut the string to [:5] and the boy is gone. It's…
-
– video
101 likes 0 comments 2 shares 11 saves
𝐩𝐫𝐢𝐧𝐭("hello") runs, because those aren't a font: they're different Unicode characters, and Python flattens names to NFKC when it parses them (PEP 3131). Each letter of print has up to 20 forms, so print alone has over 1.6 million spellings. It only flattens names, though: if in bold is a…
-
– video
9 likes 0 comments 0 shares 0 saves
"spam,scam,".split(",") returns ['spam', 'scam', ''], and that blank third word breaks the filter: '' in any string is True, even in an empty one, so any(w in comment for w in banned) blocks every comment. 'cat'.count('') is 4: there's a blank before, between and after every letter. Yet…
-
– video
59 likes 1 comment 1 share 5 saves
len('straße') is 6, but 'straße'.upper() is 'STRASSE', length 7. Unicode maps the German sharp S to SS when you uppercase it, and Python follows Unicode, even though Germany made a capital sharp S (ẞ) official in 2017. Lower it back and you get 'strasse', still 7: the original is gone. It isn't…
-
– video
15 likes 1 comment 0 shares 2 saves
a, b = b, a looks like it packs a tuple and unpacks it, but CPython skips that. Run dis on it: both values are loaded onto the stack first, then a single SWAP flips the top two slots, with no tuple and no temp variable. a, b, c = c, a, b is handled the same way. Only with four or more names does…
-
– video
75 likes 2 comments 2 shares 12 saves
sorted(['apple', 'Zebra']) gives ['Zebra', 'apple']. Python never compares letters, it compares their code points: ord('Z') is 90 and ord('a') is 97, so every capital sorts before every lowercase letter. Digits sit lower still, so '10' sorts before '9', and 'éclair' lands after 'zebra' because é…
-
– video
40 likes 0 comments 0 shares 9 saves
2**10000 in Python is exact, all 3,011 digits. In Java, Long.MAX_VALUE + 1 wraps round to -9223372036854775808, because a 64-bit integer has nowhere left to go. Python ints aren't fixed-size: CPython builds them from a chain of 30-bit digits and simply adds another when it runs out of room, so…
-
– video
33 likes 0 comments 2 shares 7 saves
zip([1,2,3], ['a','b']) gives you [(1,'a'), (2,'b')]. The 3 just disappears, with no error and no warning, because zip stops as soon as the shortest input runs out. If one list is a row short, a student's grade silently goes missing from the report, and dict(zip(keys, vals)) loses extra keys the…
-
– video
11 likes 0 comments 0 shares 4 saves
def f(): try: return 1, finally: return 2. Calling f() gives you 2. finally always runs on the way out, and its own return replaces the one that was waiting. Worse: divide by zero in try, return 'ok' in finally, and the error silently vanishes, with no traceback at all. A break or continue in…
-
– video
29 likes 0 comments 1 share 3 saves
all() starts at True and hunts for one False; any() starts at False and hunts for one True. With no items, neither finds anything, so all([]) is True (vacuous truth) and any([]) is False. Both short-circuit, so all() can stop early on a huge generator. The bug: if all(s > 50 for s in scores)…
-
– video
130 likes 1 comment 6 shares 17 saves
int() accepts any Unicode decimal digit: int('١٢٣') == 123, and Devanagari '१२३' and full-width '123' work too. Python 3.14 knows 76 different zeros, and regex \d matches them all. The real bug: '²'.isdigit() is True, but int('²') raises ValueError. Validate numbers with .isdecimal() instead…
-
– video
12 likes 0 comments 0 shares 4 saves
grid = [[]] * 3, then grid[0].append('x') and you get [['x'], ['x'], ['x']]. Multiplying a list copies the reference, not the inner list: three arrows to one box (check id()). Fix it with [[] for _ in range(3)]. [0] * 3 is fine, because ints are immutable. dict.fromkeys(names, []) has the same…
-
– video
18 likes 0 comments 2 shares 6 saves
In CPython, hash(-1) == hash(-2) is True. Small whole numbers hash to themselves (hash(5) is 5, hash(0) is 0), except -1, which comes out as -2. Inside Python's C code, -1 is the signal that an error happened, so a real -1 gets quietly bumped to -2. Make your own __hash__ return -1 and Python…
-
– video
5 likes 0 comments 1 share 1 save
Three keys go into this Python dict and one comes out: the first key, the last value. To Python, True, 1 and 1.0 are the same key: bool is a subclass of int (isinstance(True, int) is True, True + True is 2), and all three hash to 1. Equal plus the same hash means one slot, which keeps its first…
-
– video
8 likes 0 comments 0 shares 1 save
fs = [lambda: i for i in range(3)] should give 0, 1, 2. Python gives 2, 2, 2. Each lambda keeps the name i, not its value, and reads it when called, after the loop has ended on 2. A plain def does the same, i outlives the loop, and setting i = 99 makes all three say 99. JavaScript's var does it…
-
– video
11 likes 0 comments 0 shares 1 save
t = (1, [2]); t[1] += [3] raises TypeError, yet t is now (1, [2, 3]). += first grows the list in place, then tries to write back into the tuple slot, and that write is what crashes. It's in Python's official FAQ. Use t[1].extend([3]) instead: same change, no crash. #python #coding #programming…
-
– video
39 likes 1 comment 2 shares 7 saves
a = [1]; a.append(a) and the list now contains itself. print shows [1, [...]], a[1][1][1][0] is still 1, and the whole infinity costs one 8-byte pointer. Compare two of them and you get RecursionError; json.dumps refuses with 'Circular reference detected'. #python #coding #programming #learnpython…
-
– video
10 likes 1 comment 0 shares 2 saves
Intermediate Python Lesson #2: searching a set stays instant, even with ten million items. `x in my_list` checks every item one by one: 99.5 ms at 10 million. The same search in a set took about 18 ns, over five million times faster, because a set never searches: it hashes your item to a number…
-
– video
9 likes 0 comments 1 share 7 saves
-
– video
27 likes 0 comments 0 shares 4 saves
In 1997, Mars Pathfinder juggled three jobs: urgent bus work, a medium radio job and a slow weather job. The weather job and the bus job shared one lock. So the weather job grabbed the lock, the radio job shoved it aside, and the urgent job waited, stuck, until a watchdog timer reset the whole…
-
– video
20 likes 0 comments 0 shares 2 saves
Ariane 5 reused guidance code from the slower Ariane 4. It squeezed a 64-bit number, the rocket's sideways speed, into a 16-bit box that tops out at 32,767. Ariane 5 flew faster, so it overflowed. The computer crashed, and its backup, running the same code, had crashed 72 milliseconds earlier. 37…
-
– video
28 likes 0 comments 2 shares 8 saves
A for loop's else runs only if the loop never hits break. Read it as "no break" and you can drop the found flag. #python #coding #programming #learnpython #shorts
-
– video
8 likes 0 comments 0 shares 2 saves
Empty list, for loop, multiply, append... or one line: [price * 2 for price in prices]. Add if at the end and it becomes a gate. Usually faster too, but readable beats clever. #python #coding #learnpython #programming #pythontips #listcomprehension #codingforbeginners
Showing 30 of 37 videos
Load more videosExplore & export videos
Uses the videos loaded on this page. Load more to include older ones.
Videos by month
Python_everyday TikTok stats
Python_everyday (@python_facts_everyday) has 40 TikTok followers as of .
- Followers
- 40
- Likes
- 2,216
- Videos
- 37
- Likes per video
- 60
- Average video length
- 0:44
- Median per post
- 1.2K views · 24 likes · 0 comments · 1 share · 4 saves
- Average engagement per view - follower
- 1.5% - 0.82
- Average views per follower
- 55.99
- Most viewed recent posts
- “print("hello") runs, because those aren't a font: they're…” · 8.2K views · 101 likes · 0 comments ·
- “int() accepts any Unicode decimal digit: int('١٢٣') ==…” · 6.6K views · 130 likes · 1 comment ·
- “Copy text from a web page and it can carry a zero-width…” · 5.6K views · 45 likes · 3 comments ·
- Last post
- (1 day before this check)
- Posting rate
- about 7.4 posts a week
- TikTok content labels
- Professional Personal Development (21 of 28 posts), Education (21 of 28 posts)
- Hashtags used most
- #coding (28), #python (27), #programming (26), #learnpython (17), #pythontips (10)
About Python_everyday
Account created