Back

Punto Banco - Converting 10s, Jacks, Queens, Kings and Aces - 4

We want to be able to print out what cards have been dealt but we also need the value of each card. Because we will have to do this up to six times for six different cards, it makes a lot of sense to write a function for this job and then just call it when we need to. Apart from a function to deal cards, therefore, we will also need a function to check if a card is a 10, Jack, Queen, King or Ace and convert it to a 0 or 1 as appropriate. 

Q1. Modify the program you have written so far so that it looks like this:

punto3

Notice that I have used the backslash to break up long instructions and to make them clearer. I've also used lots of comments. This is a very good idea as it is easy to lose track of larger programs and helps others understand what you did.
Q2. Remove the last line print("\n\n"). What did this last line do? Is it a good idea to include it between each test? Try putting it back in and changing it to print("\n\n\n\n"). What happened?
Q3. How could you modify your test program so that it prints 'Test 1', 'Test 2' etc at the start of each test? HINT: print the counter called 'number' in the loop. 

Back