Python Forum
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dictionary questions
#8
Here are some hints:

For the first one,
len() returns the number of characters in a string. And since (di2[xxxx]) is already given, xxxx must be within di2. Also, since it's a dictionary, you should write the key which holds the value to get the value of the key.

For the second one,
In the for loop, "i" (since it is after for and before in) will hold the value of the key being iterated over. So it will have 41 in the first loop instance, 42 in the second and 43 in the third. What is 41+42+43?

Solving such questions is a great way to learn. Keep it up! :D
Reply


Messages In This Thread
dictionary questions - by atux_null - Nov-08-2017, 08:59 PM
RE: dictionary questions - by Larz60+ - Nov-08-2017, 10:09 PM
RE: dictionary questions - by atux_null - Nov-09-2017, 07:04 AM
RE: dictionary questions - by Larz60+ - Nov-09-2017, 01:13 PM
RE: dictionary questions - by atux_null - Nov-09-2017, 03:00 PM
RE: dictionary questions - by heiner55 - Nov-10-2017, 01:33 AM
RE: dictionary questions - by VlaDimitris - Jun-20-2018, 01:44 PM
RE: dictionary questions - by Nwb - Jun-20-2018, 03:45 PM
RE: dictionary questions - by ljmetzger - Jun-20-2018, 07:00 PM

Forum Jump:

User Panel Messages

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