Untitled

 avatar
unknown
python
2 years ago
1.5 kB
6
Indexable
class Frater:
    def __init__(self, name, function):
        self.name = name
        self.function = function
        
    loginflag = True
        
    def find_char(self, string, char, replace):
        if self.loginflag:
            return "permission denied"
        self.string = string
        self.char = char
        self.replace = replace
        self.temp = ""
        for self.znak in self.string:
            if self.znak == self.char:
                self.temp += self.replace
                continue
            self.temp += self.znak
            
        return self.temp        
        
    def login(self, dic):
        self.dic = dic
        self.log = input("podaj login: ")    
        self.pas = input("podaj haslo: ")
       
        if self.dic.get(self.log) == self.pas:
 
            self.loginflag = False
            
            
dic ={"tomek123":"234ter", "stach1":"123zxc"}

        
                
                                
list_name = ["krzychu", "stachu", "zdzichu"]
list_function = ["gwardian", "wikary", "ekonom"]
list_frater = []

for i in range(len(list_name)):
    list_frater.append(Frater(list_name[i], list_function[i]))
    
print(list_frater[1].name, list_frater[1].function)

class Parafia(Frater):
    def __init__(self, name, function, work):
        super().__init__(name, function)
        self.work = work
 
               
elo = Parafia(4,5,6)
print(elo.name)

test = Frater(2,3)
print(test.name)
test.login(dic)
print(test.find_char("ALA MA KOTA A KOL MA ALE", "A", "4"))
Editor is loading...