Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
32
10
146
27.3K
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@PythonPr Answer: B) hello Solution: On the surface it looks trivial. s is initialized 'hello'. t is assigned s. s is modified to upper. So it 'HELLO' now t is printed. What is the value of t? t hasn't explicitly been changed, so it's going to the initial 'hello'. But you might +
English
1
0
5
2.2K
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@PythonPr have seen some bizarre stuff with lists. Where you change one variable, and the change automatically reflects in another variable. Eg. a = [] b = a b.append(1) the append to b automatically modifies `a` as well. Why doesn't that happen here? The reason is because +
English
1
0
1
237
Paylaş