I am writing a code for school and we need to make a deck of cards as part of it. I have already made the deck but I do not know how to print it the way I want it. It either prints with all the brackets and commas or none. My goal is to print it with a comma separating every two values of the list. Any suggestions?
Here's way, maybe not the best result:
cards = ['3','A','7','Q','4']
print(f'"{", ".join(cards)}"')
Output:
"3, A, 7, Q, 4"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.