Apr 10, 2007 #1 rubicina Programmer Apr 10, 2007 1 PE I want to get a suma, but as a result I have tmin1tmin2. Please how shoul I solve this? for n in range (1,2): tmin1=10 tmin2=14 tasa = "tmin"+str+ "tmin"+str(n+1) print tasa
I want to get a suma, but as a result I have tmin1tmin2. Please how shoul I solve this? for n in range (1,2): tmin1=10 tmin2=14 tasa = "tmin"+str+ "tmin"+str(n+1) print tasa
Apr 18, 2007 #2 Trevoke Programmer Jun 6, 2002 1,142 US I'm not sure I understand. The script does exactly what you report the output to be (unsurprisingly). What do you want to do? Tao Te Ching Discussions : Chapter 4 (includes links to previous chapters) Upvote 0 Downvote
I'm not sure I understand. The script does exactly what you report the output to be (unsurprisingly). What do you want to do? Tao Te Ching Discussions : Chapter 4 (includes links to previous chapters)
May 2, 2007 #3 kmarris Programmer Jan 25, 2007 12 US I think he wanted to print '24' rather than 'tmin1tmin2'. Here's one way to do it. Code: for n in range (1,2): tmin1=10 tmin2=14 exec 'tasa = %s + %s' %('tmin' + str(n), 'tmin' + str(n+1)) print tasa Upvote 0 Downvote
I think he wanted to print '24' rather than 'tmin1tmin2'. Here's one way to do it. Code: for n in range (1,2): tmin1=10 tmin2=14 exec 'tasa = %s + %s' %('tmin' + str(n), 'tmin' + str(n+1)) print tasa