Sampai juga kita di module ke 6 dan video ke 9 dari Dave Gray, pelajaran Python for beginner.
Module 6, Chapter 1
Kita akan bicara tentang data.txt dan cara membukanya.
data.txt
hello
abc
123
kemudian data.txt dibuka file.read
with open('files/data.txt', 'r') as file:
data = file.read()
print(data)
hello
abc
123
----------------------------------------------------Module 6, Chapter 2
Write to File: Files and the Object Oriented Approach | File Handling | Alison
write file
write file
userInput = input('Enter your message : ')
with open('files/data.txt', 'w') as file:
file.write(userInput)
Enter your message : apa kabar
data.txt....> berubah:
apa kabar
w menjadi a
userInput = input('Enter your message : ')
with open('files/data.txt', 'a') as file:
file.write(userInput + '\n')
Run Python File:
Enter your message : test
data.txt....> berubah:
apa kabartest
Run sekali lagi, berubah:
apa kabartest
test2
Which of the following are file opening modes? Choose three.
- a+
- w+
- rb
-------------------------------------------------
Module 6, chapter 3: Files and the Object Oriented Approach | Binary Files | Alison
Binary File:
- difficult to access
- not use python directly, but Pickle
- use dictionary : { }
- load ...> to read (r)
- dump ...> to write (w)
Which of the following file opening modes is used for binary files? Drag the correct answer into the space provided:
- wb
--------------------------
Module 6, Chapter 4: Files and the Object Oriented Approach | Python Classes | Alison
Classes
Module 6, Chapter .
subclass
Which of the following is written in the pascal case format? Choose one.
- ThisIsPascalCase
---------------------------------------------
Module 6, Chapter 5, 6, 7, 8
Type of Variable & Methods: Files & Object Oriented Approach | Variables & Method Types | Alison
Di sini kita tentang variable & Methods
Which of these is a type of variable? Drag the correct answer into the space provided.
- instance variable
True or False: Every class method you construct in an object-oriented approach will always take "self" as an argument.
- True
-------------------------------------------
Chapter 8, Final Project; Course Project | The Voice Assistant AI | Alison
KIta akan membuat
The followings are the key points from this module:
The following are the file opening modes mentioned in the module:
w, a, r, w+,a+, r+. -- These are used for text files.
WHILE:
rb, wb. -- These are used for binary files.
The pascal case is written as thus -- ThisIsPascalCase.
The following are the variable types mentioned earlier in the module:
- Instance variable.
- Static variable.
Polymorphism is the ability to accept multiple forms of objects into a specific class.
Every method you construct in an object-oriented approach take "self" as an argument.
Course assessment: Course assessment - Python for Beginners - Course Assessment | en - 3658 - 121817 (alison.com)
JJJJJJJJJJJJJJJJJJJJJJ
No comments:
Post a Comment