+ 12

What My Error

name = {'Name': 'Pedro', 'Age': ' 30'} name['Name'] name['Age']

30th May 2019, 10:11 PM
zDev GameDev
zDev GameDev - avatar
11 odpowiedzi
+ 40
No error, but if you want to print the values in the dictionary to the console, you have to use print(): print( name['Name'] ) print( name['Age'] )
30th May 2019, 10:17 PM
Joakim Nyland
Joakim Nyland - avatar
+ 14
You don't have to use single quote in object variables name like 'Name' and 'Age' this is wrong.
15th Jun 2019, 3:27 AM
Suresh Thakur🇮🇳🇮🇳
Suresh Thakur🇮🇳🇮🇳 - avatar
+ 5
Joakim Nyland Thanks! :D
30th May 2019, 10:54 PM
zDev GameDev
zDev GameDev - avatar
+ 3
David I was wrong to just show the dictionary '-'
1st Jun 2019, 10:21 AM
zDev GameDev
zDev GameDev - avatar
+ 2
Just print them... ;)
11th Sep 2021, 3:01 PM
Tanvir Salehin
Tanvir Salehin - avatar
+ 2
No error yet, but you have to complete the code to make it useful. name['Name'] and co is just like calling you on the phone 🤳 and not saying why I called...
11th Nov 2021, 7:19 AM
James Nnanyelugo
James Nnanyelugo - avatar
+ 1
The statement name['Name'] and name['Age'] is just returning their corresponding value. To use them you need to either print them using print() func. or do some other operation. Hope it help...
2nd Oct 2021, 12:17 PM
Anshul Khangar
Anshul Khangar - avatar
+ 1
As pointed out by others just use print() to print out the values.
21st Feb 2022, 12:50 AM
Chris Avila
Chris Avila - avatar
0
You can also used a loop to print adjacent 🔑 and his value
17th May 2022, 7:03 AM
mr khan
mr khan - avatar
0
Just add print() method as- Print(name['Name']) print(name['Age'])
3rd Oct 2022, 3:42 PM
Jay Mukherjee
Jay Mukherjee - avatar
- 15
It all wrong
31st May 2019, 8:57 AM
David