Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with list
#1
hi
im trying to generat a list from some values but the list ends up kind of strange.

here how i want it to be when i print it

['test-1-1-1', 'test-1-2-2']

and here how it is

['test-1-1-1']
['test-1-1-1', 'test-1-2-2']

my code.

   def funktion(self):
        value1 = (self.a1.get())
        value2 = (self.a2.get())
        value3 = (self.a3.get())
        value4 = (self.a4.get())
        value5 = (self.a5.get())
        self.mylist = []
         
            for parts in range(value3-1, value5):
                self.mylist.append('{}-{}-{}-{}'.format(value1, value2, parts+1, parts+1))
                print (self.mylist)
What am i doing wrong?
Reply


Messages In This Thread
problem with list - by darktitan - Jul-27-2018, 03:51 PM
RE: problem with list - by ichabod801 - Jul-27-2018, 07:00 PM
RE: problem with list - by darktitan - Jul-27-2018, 10:13 PM
RE: problem with list - by darktitan - Jul-28-2018, 06:34 AM
RE: problem with list - by Axel_Erfurt - Jul-28-2018, 07:11 AM
RE: problem with list - by darktitan - Jul-28-2018, 07:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with "Number List" problem on HackerRank Pnerd 5 2,130 Apr-12-2022, 12:25 AM
Last Post: Pnerd

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020