-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathAssgn 1.py
More file actions
53 lines (45 loc) · 2.11 KB
/
Assgn 1.py
File metadata and controls
53 lines (45 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
#MyName.py
class MyName:
def __init__(self): #OnInit
self.buffered = ""
self.mName = "Olusola Ibikunle"
self.famous_person = "Archimedes"
self.message = " stated that, The upward bouyant force "
self.message1=" exerted on a body immersed in a fluid, whether fully"
self.message2=" or partially, is equal to the weight of fluid that the"
self.message3=" body displaces."
self.names=["Abbas","Ibrahim","Nuhu","shola"]
#def write(self, text):
def write(self):
text=self.mName
#self._buffered += text
self.buffered=text
# if "*" in self._buffered:
#iasterisk = self._buffered.find("*") + 1
iasterisk = self.buffered.upper()
#print(self._buffered[0:iasterisk])
print("Hello,",iasterisk,",I am taking some python classes" )
#self._buffered = self._buffered[iasterisk:]
#self._buffered = self._buffered[iasterisk:]
iasterisk = self.buffered.lower()
print("Hello,",iasterisk,",I am taking some python classes" )
print("Hello,",text,",I am taking some python classes" )
print(self.famous_person+self.message+self.message1+self.message2+self.message3)
print(self.names[0]," has been awarded a project topic on natural computing")
print(self.names[1]," has been awarded a project topic on robotics")
print(self.names[2]," has been awarded a project topic on artificial intelligence")
print(self.names[3]," has been awarded a project topic on operating systems")
def flush(self):
#print(self.buffered)
self.buffered = ""
def __len__(self): #This is a trick that I will add
return len(self.buffered)
#buffer = MyName() #a new StringBuffer is made
#buffer.write("apple")
#buffer.write("sauce*drum") #prints applesauce
#buffer.write("sticks")
#print len(buffer) #is 10
#buffer.write("*leftovers") #prints drumsticks
#buffer.flush() #prints leftovers
#print len(buffer) #after flush, is 0