One way I can suggest is

x=0; ham=''; b=['s','p','a','m'] #or, b=('s','p','a','m')
> for t in b:
>         ham=ham+b[x]
>         print(ham);x+=1
>
>
> 't' is actually  equal to b[x] and its faster then indexed based look-up.
so you can rewrite

ham = ham + b[x]

as

ham += t

and remove the x increment.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to