Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dictionary
#1
Hello. I want to figure out if there are anther ways to create such kind of dictionary (user input):

d ={'Jane': [20, 1.7],
'Jack': [15, 1.8],
'John': [12, 1.5],
--------------
a lot of line
-------------- }
thanks in advance

d = {}
L = []
i = 0
while i < 10:
  name = input('Enter your Name  :')
  age = eval(input('Input your age :'))
  height = eval(input('Input your height :'))

  L.append(age)
  L.append(height)

  d[name] = L
  L = []
  i+=1
  
  
print(d)
Reply


Messages In This Thread
dictionary - by garikhgh0 - Feb-06-2018, 05:43 AM
RE: dictionary - by gjenkinslb - Feb-06-2018, 07:19 AM
RE: dictionary - by garikhgh0 - Feb-06-2018, 07:41 AM
RE: dictionary - by buran - Feb-06-2018, 07:47 AM

Forum Jump:

User Panel Messages

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