Skip to content

Commit f40dc5f

Browse files
author
Vladimir Pavlov
committed
Commit #17
1 parent 58aed9c commit f40dc5f

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

python-classes.py

+18-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#Default function for handling execution loop:
1919
def execution_loop():
20-
#data = input("Do you want to try again ? Enter [y] - for continue / [n] - for quit : ")
2120
data = int(input("Do you want to try again ? Enter [1] - for continue / [0] - for quit :"))
2221
if data == 1:
2322
return True
@@ -29,24 +28,37 @@ def execution_loop():
2928

3029
#Function for testing definition of function outside of the class:
3130
def fl(self, x, y):
32-
return min(x, x+Y)
31+
return min(x, x+y)
3332

3433
class C:
3534
f = fl
3635
def g(self):
3736
return 'I\'m a function "g".'
3837
h = g
3938

39+
#Function for testing iterators:
40+
def iterators_func():
41+
print('Iterators fucntion was called:')
42+
print('Testing for loop statement with iterators:')
43+
for element in [1, 2, 3]:
44+
print(element)
45+
for element in (4, 5, 6):
46+
print(element)
47+
for key in {'one': 1, 'two': 2, 'three': 3}:
48+
print(key)
49+
for char in "789":
50+
print(char)
51+
for line in open("./python-classes.txt"):
52+
print(line, end='')
53+
54+
4055
#Default parameter for handling execution loop:
4156
again_exec = True
4257
counter_exec = 0
4358

4459
#Default loop for handling execution:
4560
while again_exec:
46-
first_instance = new C()
47-
print(first_instance.f())
48-
print(first_instance.g())
49-
print(first_instance.h())
61+
iterators_func()
5062
again_exec = execution_loop()
5163
counter_exec = counter_exec + 1
5264

python-classes.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To send binary files through certain systems (such as email) that do not allow all data values, they are often translated into a plain text representation (using, for example, Base64). Encoding the data has the disadvantage of increasing the file size during the transfer (for example, using Base64 will increase the file's size by approximately 30%), as well as requiring translation back into binary after receipt. The increased size may be countered by lower-level link compression, as the resulting text data will have about as much less entropy as it has increased size, so the actual data transferred in this scenario would likely be very close to the size of the original binary data. See Binary-to-text encoding for more on this subject.
2+
3+
Microsoft Windows and its standard libraries for the C and C++ programming languages allow the programmer to specify a parameter indicating if a file is expected to be plain text or binary when opening a file; this affects the standard library calls to read and write from the file in that the system converts between the C/C++ "end of line" character (the ASCII linefeed character) and the end-of-line sequence Windows expects in files (the ASCII carriage return and linefeed characters in sequence). In Unix-like systems, the C and C++ standard libraries on those systems also allow the programmer to specify whether a file is expected to be text or binary, but the libraries can and do ignore that parameter, as the end-of-line sequence in Unix-like systems is just the C/C++ end-of-line character.

0 commit comments

Comments
 (0)