Python Forum
How to let the user add 'None' to an specific array in a dictionary?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to let the user add 'None' to an specific array in a dictionary?
#2
Something like this maybe?
the_dictionary_list = {
	'Color': ['Amarillo.png', 'Blanco.png','Rojirosado.png', 'Turquesa.png', 'Verde_oscuro.png', 'Zapote.png'],
	'Cuerpo': ['Cuerpo_cangrejo.png'],
	'Fondo': ['Oceano.png'],
	'Ojos': ['Antenas.png', 'Pico.png', 'Verticales.png'],
	'Pinzas': ['Pinzitas.png', 'Pinzotas.png', 'Pinzota_pinzita.png'],
	'Puas': ['Arena.png', 'Marron.png', 'Purpura.png', 'Verde.png']}

for key, value in the_dictionary_list.items () :
	answer = input (f'Would like to add "None" to {key}? ')
	if answer.lower () == 'y' :
		the_dictionary_list [key].insert (0, 'None')
	print (key, value, '\n')
noahverner1995 likes this post
Reply


Messages In This Thread
RE: How to let the user add 'None' to an specific array in a dictionary? - by BashBedlam - Dec-26-2021, 02:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing specific values out from a dictionary mcoliver88 6 1,540 Apr-12-2023, 08:10 PM
Last Post: deanhystad
  functional LEDs in an array or list? // RPi user Doczu 5 1,784 Aug-23-2022, 05:37 PM
Last Post: Yoriz
  Creating a numpy array from specific values of a spreadsheet column JulianZ 0 1,240 Apr-19-2022, 07:36 AM
Last Post: JulianZ
  User input & Dictionary tfernandes 5 3,764 Apr-03-2020, 07:12 PM
Last Post: tfernandes
  Delete specific lines contain specific words mannyi 2 4,249 Nov-04-2019, 04:50 PM
Last Post: mannyi
  user inputs in constructing a dictionary Exsul 3 3,785 Apr-10-2019, 12:25 PM
Last Post: ichabod801
  Get specific key from multiple keys in python dictionary pradeepkumarbe 0 2,168 Mar-24-2019, 07:23 PM
Last Post: pradeepkumarbe
  User Input to Choose from Dictionary anelliaf 9 26,083 Mar-27-2018, 02:22 PM
Last Post: anelliaf
  can i nest dictionary in array? hsunteik 2 3,116 Feb-02-2017, 01:30 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

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