Re: [Tutor] Change dictionary value depending on a conditionalstatement.

2008-02-10 Thread Norman Khine
thanks Tiger12506 wrote: > >>> list = [] > total = 0 > if total > 0: >> ... x = {'id': 'name', 'link': 'XX'} >> ... list.append(x) >> ... else: >> ... y = {'id': 'name', 'link': 'YY'} >> ... list.append(y) >> ... >> > > Yeah. > > list = [] > x = {'id':'name'} > if total

Re: [Tutor] Change dictionary value depending on a conditionalstatement.

2008-02-10 Thread Tiger12506
>>> list = [] > >>> total = 0 > >>> if total > 0: > ... x = {'id': 'name', 'link': 'XX'} > ... list.append(x) > ... else: > ... y = {'id': 'name', 'link': 'YY'} > ... list.append(y) > ... > Yeah. list = [] x = {'id':'name'} if total > 0: x['link'] = 'XX' else: x['link'] = 'Y