Tag: Format

Python Tables

tableI was asked in class how we can create a table in Python. There are a number of ways to do this but the easiest is probably to use the .format method.

The program reads in data from a CSV file before displaying the information in a two column table. There is a lot of internal commentary you can strip out leaving just the code.

The main part of the program is line 28. Where the contents of names and scores are displayed one line at a time with padding to make them appear to be in a table.

Read more

Using a message box to make a choice

It is possible to use a MsgBox to make a choice in your program. You first of all assign a integer variable to the MsgBox then you change the buttons attributes to vbYesNo. vbYesNo is a VB constant that represents a value, the use of the constant means that you do not need to memories the number, vbYes and vbNo are other examples of these VB constants. An IF statement is then used to make the selection.

N5