Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

i need output in dictionary without using list,tuple,append

$
0
0
D={'name':'hello'}output = {'n':'hello','a':'hello','m':'hello','e':'hello'}

need this output write a python code without using list,tuple,append

d = {'name': 'Hello'}output = {}for char in d['name']:  output[char] = 'hello'print(output)

but i got this output={'H': 'hello', 'e': 'hello', 'l': 'hello', 'o': 'hello'}

I'm expecting output = {'n':'hello','a':'hello','m':'hello','e'='hello}


Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>