Exercise 5

Exercise 5
1 / 6
volgende
Slide 1: Tekstslide
Ilearningdeal@gmail.comFurther Education (Key Stage 5)

In deze les zitten 6 slides, met interactieve quiz en tekstslides.

time-iconLesduur is: 40 min

Onderdelen in deze les

Exercise 5

Slide 1 - Tekstslide

f=open("c:\\demo.txt", "w")
f.write("this is for testing purpose")
f.close()
f=open("c:\\theta.txt","w")
f.write("when i am in theta mode i become creative")
f=open("C:\\test\\test14.txt", "r")
print (f.read(8))
print (len(f.read()))
You need to open a new files on your "onlinegdb! called 
1. c:\demo,txt
2.c:\theta.txt
3. c:\test\test4.txt
a. enter text ic:\test\test14.txt file
b, when you run the program it will write to the file the text and you can see it when you open the file.
c. When the program read from the file in will display the text at the terminal.
The teacher will explain how to do this. 
The program either opens a file for writing  then write the file 

Slide 2 - Tekstslide

Slide 3 - Link

EXERCISE 5 – READ AND WRITE FILES

You are writing a program for that needs to do the following
First create a text file called demofile.txt and write the following into it
Hello! Welcome to demofile.txt
This file is for testing purposes.
Good Luck!
Next write a method to read this file (demofile.txt) and display its contents
Next write a function in your chosen programming language to create a new file called (writefile.txt ) and add the following text to this file
This is some new content to add to a new file!
Call this function in the program so the file gets created successfully. Demonstrate to your tutor that this file is created







Slide 4 - Tekstslide

Write down at least 3 errors you encountered and how you resolved them

Slide 5 - Open vraag

Copy and paste your work into your assignment

Slide 6 - Tekstslide