python - assign value in a list -


while true:     p = []     q = []     h = []     e = []     m in range(n):         p = (i-d[m-2][1])/d[m-2][0]         q.append(p)     print q      r = q[0]     if r  < g[1][0]:         r == g[1][0]     elif r > g[1][1]:         r == g[1][1]     print r 

for problem of coding above, want explain in simpler manner.

i = [3,5]  r = [5,6]  if i[0] < r[0]:     i[0] == r[0]     print 

however, not [5,5] in example, why? output still [3,5]

the following lines comparisons rather assignments:

    r == g[1][0]     r == g[1][1]     i[0] == r[0] 

i suspect meant write

    r = g[1][0]     r = g[1][1]     i[0] = r[0] 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -