- 1

Program to print a word number of times it has value beside it

Eg-: xyz:4,abc:2 Program should print xyz xyz xyz xyz Abc abc

1st Feb 2017, 9:01 AM
Rahul Goyal
Rahul Goyal - avatar
2 Respostas
+ 1
dat = {"xyz":4 ,"abc":2} for x in dat: print ((dat[x] + " ") * x)
1st Feb 2017, 10:58 AM
Javier I. Rivera R.
Javier I. Rivera R. - avatar