0

Any better way to do this?

also either way is there also a way to make the final print nicer without any brackets or quotes? https://code.sololearn.com/cBRYzGo57T5d/?ref=app

24th Feb 2018, 2:51 PM
Daniel Robertson
Daniel Robertson - avatar
3 Answers
+ 4
I can't tell a better way of doing this as I have no clue what you are trying to accomplish with it. I added nicer printing. https://code.sololearn.com/c8C68Hq8Vxp0
24th Feb 2018, 3:27 PM
John Wells
John Wells - avatar
+ 2
awesome! thank you i probably should have made some notes in it but basically i wanted to randomly choose a key from the dictionary then print the key and list associated with it
24th Feb 2018, 4:05 PM
Daniel Robertson
Daniel Robertson - avatar
+ 1
This gets your random choice: ship, value = random.choice(list(thing.items())) print(ship, end=": ") for item in value: print(item, end = " ") print()
24th Feb 2018, 5:05 PM
John Wells
John Wells - avatar