Python: How to use a dictionary with user input

preview_player
Показать описание

Absolutely no experience in programming required. Learn practical Python skills and get up and running in Python today.
Рекомендации по теме
Комментарии
Автор

how do you attach more than 2 keys? like username, address, phone-number ?

bullychug
Автор

Thank you so much! you saved me and i finally completed my assignment

Honey-rpzx
Автор

Thanks, this helped me a ton with creating my own program.

Valdaur
Автор

rental_properties = {}

rental_open = True

while rental_open:
username = input("\nWhat is your name ?")
rental_property = input("What is the address of the property you want to rent ?")

rental_properties[username] = rental_property
repeat = input("\nDo you know anyone who might rent some properties ?")
if repeat == "no":
rental_open = False

print("\n~~~Property to rent~~~")
for username, rental_property in rental_properties.items():
rent")

abhijeetsethuraman
Автор

Could you possibly make a video on user inputs used in classes?

FeralMarauder
Автор

What if you would like to search the dictionary by value asking the user to put in that value

thairston
Автор

What would I do if I had an input to enter the name of a dictionary, and wanted to access a value inside the dictionary from that input
Such as:
dict = {
"keyA": "valueA"
"keyB": "valueB"
}
dict_name = input("What dictionary do you want to open? ") #user enters "dict"
print(dict_name[keyB])

calebvonweichardt
Автор

if i have a dictionary with key:value stored, and say my key is 'add' and my value is a function to add two numbers together, how would i write the loop to take user input to call the function?

stevenmarlow
Автор

please explain class in brief. It seem very confusing to me ..like what is self, why we use self.

natsudragneel
Автор

Sir I don't understand this portion
Store the username in the empty dictionary ..

avheeaziz
Автор

Thankyou so much sir . wonderfull explanation

natsudragneel
Автор

what output = {**input} does in python where input is a dict

angelpisco
Автор

@tony Staunton. Can u share the code for nested dictionary by user input?

ganesham
Автор

I want to ask abiut #store the respone in the dictionary i dont get it

sarikhoury