Intro to Python — Lesson 8

Publié le: 10 août 2020
sur la chaîne: 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  


Sur cette page du site, vous pouvez voir la vidéo en ligne Intro to Python — Lesson 8 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur KPMG:Code 10 août 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 454 fois et il a aimé 8 téléspectateurs. Bon visionnage!