Statistics worth saving.

Write a script that imports the text statistics script, counts the dummy text and exports the statistics you gathered, using JSON.1

Save some contacts.

Step 1

In More objects! you wrote a rudimentary contact manager. Time to create a little generator around it to automatically fill it with some dummy data.

Load this (Rightclick -> Download Linked File) JSON file to get a list of first- and lastnames.
Use the builtin module random2 to pick one element from those lists of names.
The mail-address should be firstname.lastname@python.course.

Step 2

Now write a script that generates about 20 contacts and dumps them via JSON.

Use randomly generated 12 digits long numbers for the phone numbers. The date of birth can be ignored. Use a hard coded value like 01.01.1859 for all generated contacts.

Step 3

If there is already a JSON file3, load it, add 3 more contacts and dump it again.

Test your script.

  1. See the docs for more information on how to use JSON. 

  2. You should initialize the random with random.seed() and get an randint in a certain range. Have a look into the docs for further information. 

  3. To check if an file exists, you can use os.path.exists(filename)