Post

Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr x = x + 3 creates new local integer as ints are immutable. So global x remains 5.
English
0
1
9
966
Andrés del 56%
Andrés del 56%@libera_andres·
@PythonPr 5 because the parameter x is passed by value, not by reference
English
0
0
3
529
R. Stephen Ruiz
R. Stephen Ruiz@rslruiz·
@PythonPr Ans. B. 5 x local is changed to 8, but x global remains the same, 5.
English
0
0
2
137
Brock Prudy
Brock Prudy@Secret49erFan·
@PythonPr The new value is not captured when change (x) is run so it outputs the global 5.
English
0
0
1
32
O_pauloski_7
O_pauloski_7@OlusolaPaul8·
@PythonPr 5 Because 3 wasn’t assigned to any parameters
English
0
0
1
115
Chibueze Okonkwo Donald
Chibueze Okonkwo Donald@DonaldXoftDev·
@PythonPr x is 5 cuz the global variable of x is 5 and what is returned to the function beva gets printed otherwise, it would be 8
English
0
0
1
551
laso
laso@lasitolas·
@PythonPr B. The scoping element ensures that the increment is not applied hence the variable x remains 5
English
0
0
1
74
Toji Fushiguro
Toji Fushiguro@kenpachi126408·
@PythonPr 5 because The function (x) returns a new value (8) but doesn't modify the original variable x because integers are immutable in Python and the function parameter creates a copy. The print(x) statement outputs the original value of x (5).
English
0
0
1
517
Paylaş