title: get the list of values outside of loop-Python
body: <p>I want to get variable output a (which is in loop), outside of loop</p>
  
  <pre><code>        stopped_reasons = []
          output=[]
  
  
  
  
           client = boto3.client('ec2')
           reservations = client.describe_instances().get('Reservations', []) 
  
           for reservation in reservations:
               for instance in reservation['Instances']:
                 tags = {}
                 for tag in instance['Tags']:
  
                      tags[tag['Key']] = tag['Value']
                      if tag['Key'] == 'Name':
                        name=tag['Value']     
               if instance['State']['Name'] == 'stopped':
  
                   instance_ids.append(instance['InstanceId'])
                   instance_names.append(name)
                   stopped_reason = instance['StateTransitionReason']
                   stopped_reasons.append(stopped_reason)
                   transition_timestamp = datetime.strptime(instance['StateTransitionReason'][16:39], '%Y-%m-%d %H:%M:%S %Z')
                   #print (datetime.now() - transition_timestamp).days
                   a="Instance:"+ instance['InstanceId']  + '  Name: ' +name + "TIME: "+str(transition_timestamp)
                   print a
                   output.append(a)
  
  print output 
  </code></pre>
  
  <p>print a (inside loop) gives what i want:</p>
  
  <pre><code>Instance:i-03666a1aea6028cf0  Name: aws-opsworks-cm-instance-mypuppet-1541455366196TIME: 2018-11-15 18:30:27
  Instance:i-0a67100fa09eab573  Name: Choco_ServerTIME: 2018-11-29 18:30:27
  </code></pre>
  
  <p>I'm trying to get same output but outside for loop. so i declared list output and appended a variable</p>
  
  <p>but print output (outside loop) gives one line</p>
  
  <pre><code>['Instance:i-03666a1aea6028cf0  Name: aws-opsworks-cm-instance-mypuppet-1541455366196 TIME: 2018-11-15 18:30:27', 'Instance:i-0a67100fa09eab573  Name: Choco_Server TIME: 2018-11-29 18:30:27']
  </code></pre>