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
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
+ 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
+ 1
This gets your random choice:
ship, value = random.choice(list(thing.items()))
print(ship, end=": ")
for item in value:
print(item, end = " ")
print()