Python Forum
Dictionaries homework
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dictionaries homework
#5
I would say line 17 is in the wrong place. You are changing tup from a list to a tuple. But if you do that, you can't append to it any more. So line 17 is meant (I think) to change it back to an empty list.

The thing is, this is way more work than you need to do to create a tuple. You can just create one with tup = (word, rev_word). In this code, there is no reason to even store it in a variable. You could just create it and append it at the same time (new_lst.append((word, rev_word))).
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Dictionaries homework - by pythoncrazy1 - Dec-11-2018, 03:39 PM
RE: Dictionaries homework - by Gribouillis - Dec-11-2018, 03:55 PM
RE: Dictionaries homework - by pythoncrazy1 - Dec-11-2018, 04:02 PM
RE: Dictionaries homework - by nilamo - Dec-11-2018, 08:42 PM
RE: Dictionaries homework - by ichabod801 - Dec-11-2018, 09:48 PM
RE: Dictionaries homework - by pythoncrazy1 - Dec-11-2018, 10:35 PM
RE: Dictionaries homework - by nilamo - Dec-11-2018, 10:42 PM
RE: Dictionaries homework - by ichabod801 - Dec-12-2018, 12:25 AM
RE: Dictionaries homework - by pythoncrazy1 - Dec-12-2018, 11:31 PM

Forum Jump:

User Panel Messages

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