+ 1
How do i call multiple value from a dictionary?
9 Réponses
+ 6
What do you mean exactly? Dictionaries are basically key-value pairs, how do you want to "call multiple values" there?
+ 4
a = {1:"a",2:"b"}
b = "12"
s = "".join([a[int(i)] for i in b])
print(s)
+ 2
Explain what you are trying to do in your code
+ 2
{1:a, 2:b 3:c}
And input is '12' how do i output ab' together?
+ 2
d = {1:"a",2:"b"}
s = ""
for i in d:
s += d[i]
print(s)
+ 2
In my example, change variable b to b = int(input("Enter your number")) or str(input("Enter your number")), whatever your dict key type is
+ 1
code={
'1' : 'a',
'2' : 'b',
'3' : 'c',
}
s = ""
aske=input("enter you number ")
for aske in code:
s += code[aske]
print(s)
#i want this code to print out the value of two or more numbers when enteered
+ 1
d = {'1':'a','2':'b','3':'c'}
s = ''
ask = list(input('enter your number'))
for i in ask:
s += d[i]
print(s)
0
Contribute guys