Thursday 28 January 2016

03 - Solution Development (9 marks)

Lesson Objectives

Use Python to read() the contents of a file


Task 1
Open a file on your drive. 
Controlled Assessment files have been emailed to you - check your mail.
NB. Make sure it is saved in the same location as your python file.








~~~Your Task~~~ 
Write a program that will open() and read() the contents of your file and display it in the screen to test it has loaded.


Task 2

As the scenario asks you to select random words from the file you may want to consider storing it as a list.


Knowing about indices in a list is very useful and if you use the correct conventions Python will instantly recognise your list as a list.



Task
Create a list to hold members of your family. Then use the print() function to print out their names as shown.





~~~Your Task~~~ 
1. Create a program that will prints out random members of your family, using a list as reference, using the random library and rand int
How could you print them in a grid?



Useful site for lists - HERE and for random  - HERE


No comments:

Post a Comment