mama b
mama b

Reputation: 21

How to show the first 13 cards

I am trying 2 different codes on how to print the first 13 cards but i can't seem to know how.

1. enter image description here

I need to print only the first 13 cards here but idk how to.

2.enter image description here

This another code, I am confused on list slicing and how to remove the '' between them

I was able to print the first 13 cards but I am confused why it is [1:91] if I already put "" per string? And I dont know how to remove the '' between strings and spaces before the parenthesis.

I have to print the first 13 cards (which were C) but I dont know how

Upvotes: 0

Views: 92

Answers (1)

Talpa
Talpa

Reputation: 89

Please do not use images to upload text.

houses = ['C', 'D', 'H', 'S']
ranks = ['A', '2', '3' ... 'Q', 'K']
deck = []

for house in houses:
    for rank in ranks:
        deck.append(f"{rank}-{house}")

for i in range(13):
    print(deck[i])

Upvotes: 1

Related Questions