In the below sample code I'm not understanding why in my sent_message() I get output from smsg but not txt_msgs[0] Also not understanding why my sent_msg list remains empty?
txt_msgs = ['Mr Johnson, your new Cornwell Banks credit card is waiting for you at 13 High Street.', 'Boarding for your flight 320-YBO starts 12.11.2018 at 3:30pm. Enjoy your flight, Fair Airlines.', 'Booking confirmation: 4445789-YY. Millington Hotel is expecting you on 22.12.2018. Thank you for your order!']
sent_msg = []
def show_messages(txt_msgs):
for msg in txt_msgs:
print(f"\n{msg}")
def sent_messages(txt_msgs):
for msg in txt_msgs:
smsg = txt_msgs.pop()
sent_msg.append(smsg)
print(f"\n{smsg}")
#print(txt_msgs)
print(sent_msg)
#show_messages(txt_msgs)
sent_messages(txt_msgs)
Here's the output I get:
[]
Booking confirmation: 4445789-YY. Millington Hotel is expecting you on 22.12.2018. Thank you for your order!
Boarding for your flight 320-YBO starts 12.11.2018 at 3:30pm. Enjoy your flight, Fair Airlines.
[Finished in 0.0s]