1 / 25

PYTHON TIMES TABLE 4

PYTHON TIMES TABLE 4. This is the last code we saved. It deals correctly with both x and x*y single and double numbers. PYTHON TIMES TABLE 4. How does it handle triple number answers?. PYTHON TIMES TABLE 4. How does it handle triple number answers? They don’t format properly.

andream
Télécharger la présentation

PYTHON TIMES TABLE 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PYTHON TIMES TABLE 4 This is the last code we saved. It deals correctly with both x and x*y single and double numbers.

  2. PYTHON TIMES TABLE 4 How does it handle triple number answers?

  3. PYTHON TIMES TABLE 4 How does it handle triple number answers? They don’t format properly.

  4. PYTHON TIMES TABLE 4 We need to deal with the triple answer numbers as we did with the x double numbers but….

  5. PYTHON TIMES TABLE 4 But first… Have we dealt with the single and double y numbers? Run the 9 times table then try 10, 11 and 12 times tables. Is there a formatting problem?

  6. PYTHON TIMES TABLE 4 With the 10, 11 and 12 times tables there does not appear to be a formatting problem with y number. What is the reason?

  7. PYTHON TIMES TABLE 4 With the 10, 11 and 12 times tables there does not appear to be a formatting problem with y number. What is the reason? It is simply because the y value does not change throughout the table. So No change – No action

  8. PYTHON TIMES TABLE 4 The only major formatting problem now occurs when the x*y answer changes from a double to a triple number ie. When it exceeds 99. Lets have a go.

  9. PYTHON TIMES TABLE 4 When you are dealing with a problem the first step is always to try and find out exactly what is definitely NOT causing a problem i.e. what is NOT wrong so we can try and see just what is left which could be causing the problem.

  10. PYTHON TIMES TABLE 4 We have already found that the problems of formatting triple figure x*y answer numbers first occurs in the 9 times table when 12 x 9 = 108. Which tables therefore are formatting correctly?

  11. PYTHON TIMES TABLE 4 A suggestion is firstly let 2 to 8 times table run normally and then we will deal with the 9 times table How do we allow only the 2 to 8 times to run?

  12. PYTHON TIMES TABLE 4 A suggestion is firstly let 2 to 8 times table run normally and then we will deal with the 9 times table How do we allow only the 2 to 8 times to run? Change while x <= 12: to:- while x <= 12 and y <=8:

  13. PYTHON TIMES TABLE 4 The original was:- while x <= 12: Which we have now changed to:- while x <= 12 and y <=8:

  14. PYTHON TIMES TABLE 4 The original was:- while x <= 12: Which we have now changed to:- while x <= 12 and y <=8: and is the second logic term; the first was the if term.

  15. PYTHON TIMES TABLE 4 The original was:- while x <= 12: Which we have now changed to:- while x <= 12 and y <=8: and is the second logic term; the first was the if term. There are more logic terms:-

  16. PYTHON TIMES TABLE 4 A fuller list of logic terms is:- if testing of certain values and both values must be true or either value must be true NOT the value must NOT be true

  17. PYTHON TIMES TABLE 4 A fuller list of logic terms is:- if testing of certain values and both values must be true or either value must be true NOT the value must NOT be true What is the opposite of TRUE?

  18. PYTHON TIMES TABLE 4 A fuller list of logic terms is:- What is the opposite of TRUE? The opposite of TRUE is FALSE. TRUE and FALSE could be shown as ONE, 1 and ZERO, 0.

  19. PYTHON TIMES TABLE 4 A fuller list of logic terms is:- What is the opposite of TRUE? The opposite of TRUE is FALSE. TRUE and FALSE could be shown as ONE, 1 and ZERO, 0. Computers use 0’s and 1’s.

  20. PYTHON TIMES TABLE 4 Now that only the 2 to 8 times tables are allowed to run, we can start to have a go at formatting the 9 times table:-

  21. PYTHON TIMES TABLE 4 Now that only the 2 to 8 times tables are allowed to run, we can start to have a go at formatting the 9 times table:- Copy the complete original if term and paste it below the original.

  22. PYTHON TIMES TABLE 4 x = 1 y = 9 while x <= 12 and y <=8: # This deals with 2 to 8 times tables if x*y <=9: print ( ' ', x, 'x', y, '= ', x*y) elif x <=9: print ( ' ', x, 'x', y, '=', x*y) elif x >= 10: print ( ' ', x, 'x', y, '=', x*y) x = x + 1 while x <= 11 and y ==9: # This deals with 1 x 9 to 11 x 9 only if x*y <=9: print ( ' ', x, 'x', y, '= ', x*y) elif x <=9: print ( ' ', x, 'x', y, '= ', x*y) elif x >= 10: print ( ' ', x, 'x', y, '= ', x*y) x = x + 1 while x == 12 and y ==9: # This deals when 12 x 9 = 108 print ( ' ', x, 'x', y, '=', x*y) x = x + 1

  23. PYTHON TIMES TABLE 4 Try the code with the 10 times table followed by the 11 times table. Next try the 12 times table.

  24. PYTHON TIMES TABLE 4 Try the code with the 10 times table followed by the 11 times table. Next try the 12 times table. You will find that there is a problem with the 9 x 12 = 108. Its just the same as 12 x 9 = 108 yet again! I will leave it to you!

  25. PYTHON TIMES TABLE 4 This is the end of TIMES TABLE 4

More Related