Python: How to use a dictionary with user input

Python: How to use a dictionary with user input

Tony Staunton

5 лет назад

52,130 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Honey
Honey - 05.09.2023 17:31

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

Ответить
Sarah Denno
Sarah Denno - 05.09.2023 17:31

thanks hero

Ответить
IG
IG - 24.04.2023 21:14

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

Ответить
Angel pisco
Angel pisco - 20.04.2022 10:58

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

Ответить
Anthony Hairston
Anthony Hairston - 25.05.2021 01:08

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

Ответить
Ganesha M
Ganesha M - 21.03.2021 09:24

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

Ответить
Hamza Mehaizea
Hamza Mehaizea - 28.02.2021 21:01

rental_pro [name]= rental_pro (did not work )

Ответить
Avhee Aziz
Avhee Aziz - 21.09.2020 21:25

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

Ответить
Bully Chug
Bully Chug - 07.05.2020 21:54

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

Ответить
Abhijeet Sethuraman
Abhijeet Sethuraman - 14.01.2020 21:28

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():
print(username+"has"+rental_property+"to rent")

Ответить
Natsu Dragneel
Natsu Dragneel - 05.01.2020 08:45

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

Ответить
Natsu Dragneel
Natsu Dragneel - 05.01.2020 08:43

Thankyou so much sir . wonderfull explanation

Ответить
steven marlow
steven marlow - 14.12.2019 01:02

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?

Ответить
Feral Marauder
Feral Marauder - 01.05.2019 04:52

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

Ответить