Intro to Python — Lesson 8

Published: 10 August 2020
on channel: KPMG:Code
454
8

In this session we cover:
Files
Reading Files
Writing Files

Next Lesson:    • Intro to Python — Lesson 9  
Previous Lesson:    • Intro to Python — Lesson 7  
Playlist for whole course:    • Introduction to Python  
Course Material: https://github.com/ihf-code/python
Repl with Files to Fork: https://replit.com/@smirza3/pythontwf...

Questions:
Section A
1. Read the file 'jabberwocky.txt' and print its content to the screen
2. Read the file 'austen.txt' and print the amount of lines in the file
3. Each line of the file 'numbers.txt' contains a number, write a script to add up all the values in the file

Section B
1. Ask the user to enter their name and append this to a file called 'register.txt'
2. Create a new file called 'even.txt' that contains only the even numbers from the file 'numbers.txt'
3. 'secret.txt' contains a secret message. Each number represents the letter of the alphabet where 1 = A, 2 = B ... Z = 26. Work out what the secret message says
4. Benford’s law states that the leading digits in a collection of data are probably going to be small. For example, most numbers in a set (about 30%) will have a leading digit of 1, when the expected probability is 11.1% (i.e. one out of nine digits). Fake data is usually evenly distributed, where as real data The files 'accounts_1.txt', 'accounts_2.txt' and 'accounts_3.txt' contain financial transaction data. Work out which of the files contains fake data.

Answers:
Answers to these questions available:    • Intro to Python — Lesson 8 — Answers  


On this page of the site you can watch the video online Intro to Python — Lesson 8 with a duration of hours minute second in good quality, which was uploaded by the user KPMG:Code 10 August 2020, share the link with friends and acquaintances, this video has already been watched 454 times on youtube and it was liked by 8 viewers. Enjoy your viewing!