Intro to Python — Lesson 8

Опубликовано: 10 Август 2020
на канале: 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  


На этой странице сайта вы можете посмотреть видео онлайн Intro to Python — Lesson 8 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь KPMG:Code 10 Август 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 454 раз и оно понравилось 8 зрителям. Приятного просмотра!