跳到主要内容

r/pythontips


Python Data Model Exercise
Python Data Model Exercise
Module

An exercise to help build the right mental model for Python data.

# Output of this Python program?
a = [[1], [2]]
b = a
b[0].append(11)
b = b + [[3]]
b[1].append(22)
b[2].append(33)

print(a)
# --- possible answers ---
# A) [[1], [2]]
# B) [[1, 11], [2]]
# C) [[1, 11], [2, 22]]
# D) [[1, 11], [2, 22], [3, 33]]

The “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵.


Advertisement: When everything lines up, you move. Take advantage of our best pricing from the moment you fund through the rest of the month plus 60 additional days. Trade options at $0 per leg and get up to $3,500 in rewards. No waiting. No ramp up period. Are you in? Limited time only.
When everything lines up, you move. Take advantage of our best pricing from the moment you fund through the rest of the month plus 60 additional days. Trade options at $0 per leg and get up to $3,500 in rewards. No waiting. No ramp up period. Are you in? Limited time only.
When everything lines up, you move. Take advantage of our best pricing from the moment you fund through the rest of the month plus 60 additional days. Trade options at $0 per leg and get up to $3,500 in rewards. No waiting. No ramp up period. Are you in? Limited time only.


Giving back to the community - The Complete Backend Development Course
Giving back to the community - The Complete Backend Development Course
Long_video

Hey everyone, I decided to make my course free in order to help people.
This course is my backend development course which is about SQL, Python, APIs, Docker, Kubernetes, Linux, Git & More

The link is: https://www.youtube.com/watch?v=CBIu6hcyStg

If you can like and subscribe (and maybe add a comment) I would appreciate it a lot, Thanks.