Course Solutions Uncategorized (Solved) : Code 1 2 3 4 5 6 Print Print Output Got 1 2 3 4 5 6 Inside Loop Changed List 4 5 6 Think Q29804764 . . . .

(Solved) : Code 1 2 3 4 5 6 Print Print Output Got 1 2 3 4 5 6 Inside Loop Changed List 4 5 6 Think Q29804764 . . . .

 

For the code:
==============================
a = [1,2,3]
for i in a:
a = [4,5,6]
print(i)
print(a)
==============================
The output I got is
=====================
1
2
3
[4, 5, 6]
=====================
but inside the loop, I changed the list a to [4,5,6]. I think theelement i should change too because i is the element in the list a.But the integer “i” did not change, even if the list change.

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : Q29168049 . . . .(Solved) : Q29168049 . . . .

<p><img alt="<div class-container-fluid> <div class-row <div class:col-3> <div class input-group-prepend> <span class-input-group-text id:searchMovieTitle>searchfor Movie Title</span> kinput type-text class-form-control placeholder-title aria-describedby-searchMovieTit </div> <div *ngIf-movieTitle.value class-searchList> <span *ng1f=moviesLoading > Loading</span> ca class-dropdown-item