영어 에세이를 적는 원칙중에, 모든 글은 쉽게 쓰는 방법이 있으면 그렇게 써야한다 원칙이 있습니다.

코딩도 비슷한 원칙을 갖고있습니다. 

어제 밤에 블로그 포스팅을 하고 오늘 아침에 내가 한 코드를 봤었는데요.

 

너무 부족한 부분이 많이 보여서 

다시 수정을 했어요, 왜 당장 처음할때는 보이지 않았던 문제들이 이제와서 보이는건지 참 .... 

 

class Labotory:
    def __init__(self, name, Idnumber, origin):
        self.name = name
        self.number = Idnumber
        self.origin = origin
     
    def introduce(self):  # Corrected method name from lntroduce to introduce
        print(f'My name is {self.name} and from {self.origin}')

   
Labomen = [Labotory("Okabe_rintarou", "001", "Japan"),
           Labotory("Shiina_Mayuuri", "002", "Japan")]
           

class Microwave:
    def __init__(self):
        self.is_on = False
        self.messages = []  # Added messages attribute

    def turn_on(self):
        self.is_on = True
        print("Microwave is now on")

    def turn_off(self):
        self.is_on = False
        print("Microwave is now off")
   
    def receive_message(self, sender, message):
        print(f"{self.__class__.__name__} received message from {sender.name}: {message}")
        self.messages.append(message)

class CrtTv:
    def __init__(self):
        self.is_on = False
   
    def turn_on(self):
        self.is_on = True
        print("The CRT TV is now on")

    def turn_off(self):
        self.is_on = False
        print("The CRT TV is now off")

class DivergenceMeter:
    def __init__(self):
        self.current_divergent_value = 0.571040
        self.divergent_value_log = []

    def change_value(self):
        self.current_divergent_value += 0.003
        print(f"Divergence Meter changed to {self.current_divergent_value}")
        self.divergent_value_log.append(self.current_divergent_value)

class GameStory:
    def __init__(self, labomen, microwave, crt_tv, divergence_meter):
        self.labomen = labomen
        self.microwave = microwave
        self.crt_tv = crt_tv
        self.divergence_meter = divergence_meter

    def send_message_to_change_divergence_meter(self):
        if self.microwave.is_on and self.crt_tv.is_on:
            print(f"{self.labomen.name}: I want to change the world")
            message = "elp, psy, kongoroo"
            self.microwave.receive_message(self.labomen, message)
            self.divergence_meter.receive_message(self.labomen, message)
            self.divergence_meter.change_value()
        else:
            print("Seems like nothing has changed.....")
   
    def show_the_divergence_meter_history(self):
        print("Divergence meter history:")
        for value in self.divergence_meter.divergent_value_log:
            print(value)

# Create instances
microwave = Microwave()
crt_tv = CrtTv()
divergence_meter = DivergenceMeter()

# Instantiate GameStory with the first Labotory instance
game_story = GameStory(Labomen[0], microwave, crt_tv, divergence_meter)

# Call the method on the GameStory instance
game_story.send_message_to_change_divergence_meter()

# Show the divergence meter history
game_story.show_the_divergence_meter_history()

#Let's make it happen

microwave.is_on()
crt_tv.is_on()
game_story.send_message_to_change_divergence_meter()

오늘 하루 2시간 동안 짠 건데 좀 많이 부족해 보이네요 살 좀 붙여야겠다

과제.. 인것도 있음, 내가 좋아하는 걸로 제출하면 그래도 동기부여가 꾸준히 될 줄 알고 하고 있는데

동기부여보다는 내가 사랑하는 것들을 하다커녕 그냥 마음만 아픈데요???

 

처음 구조를 잡은 것 

class World_line_alpha:
    def __init__(self, labomen, microwave, crt_tv, divergence_meter):
        self.labomen = labomen
        self.microwave = microwave
        self.crt_tv = crt_tv
        self.divergence_meter = divergence_meter

    def send_message():


    def send_message_to_change_divergence_meter(self, labomen):
        if self.microwave.is_on and self.Crt_tv.is_on :
            print(f"{labomen}: I want to send change the world")
            self.labomen.send_message(self.microwave)

    def labomen():
        print(f'My name is {labomen}')

# Without the self parameter, the method wouldn't know which instance's attributes to modify or access.
# The use of self helps Python distinguish between attributes of different instances of the same class.

class Microwave:
    def __init__(self):
        self.is_on = False

    def turn_on(self):
        self.is_on = True
        print("Microwave is now on")

    def turn_off(self):
        self.is_on = False
        print("Microwave is now off")

    def receive_message(self, message):
        if self.is_on and self.CRT_TV.is_on :
            print(f"Received message: {message}")
            self.divergence_meter.change_value()
        else:
            print("No message. You will get a nice food.")

class Crt_tv:
    def __init__(self):
        self.is_on = False
   
    def turn_on(self):
        self.is_on = True
        print("The CRT TV is now on")

    def turn_off(self):
        self.is_on = False
        print("The CRT TV is now off")

class DivergenceMeter:
    def __init__(self):
        self.value = 0.571040

    def change_value(self):
        self.value += 1
        print(f"Divergence Meter changed to {self.value}")



# Scenario -------------------
microwave = Microwave()
divergence_meter = DivergenceMeter()
World_line_alpha = World_line_alpha(labomen, microwave, divergence_meter)

microwave.turn_on()
Crt_tv.turn_on()
World_line_alpha.send_message_while_microwave_on
 

오류가 여럿 보여서 구조를 좀 더 달리생각했습니다. 

그리고 뼈대를 수정을 좀 했어요

나머지 살 붙이는 건 아무래도 내일 해야 할 거 같네요.


class Labotory:
    def __init__(self, name, Idnumber, origin):
        self.name = name
        self.number = Idnumber
        self.origin = origin
     
    def lntroduce(self, name):
        print(f'My name is {name}')
   
    #def __str__(self):
        #return f"
    #TEST
Labomen =[Labotory("Okabe_rintarou", "001", "Japan"),
    Labotory("Shiina_Mayuuri", "002", "Japan"),
    Labotory("Hashida_itarrum", "003", "Japan"),
    Labotory("Makise_Kurisu","004", "America" ),
    Labotory("Kiryu_moeka", "005", "Spoiler"),
    Labotory("Urushibara_ruka","006", "Japan"),
    Labotory("Feiris_nyannyan","007","Japan"),
    Labotory("Amane_Suzuha","008", "Spoiler"),
    Labotory("Hiyajou_maho","009","Spoiler")]


   

class Microwave:
    def __init__(self):
        self.is_on = False

    def turn_on(self):
        self.is_on = True
        print("Microwave is now on")

    def turn_off(self):
        self.is_on = False
        print("Microwave is now off")

class CrtTv:
    def __init__(self):
        self.is_on = False
   
    def turn_on(self):
        self.is_on = True
        print("The CRT TV is now on")

    def turn_off(self):
        self.is_on = False
        print("The CRT TV is now off")

class DivergenceMeter:
    def __init__(self):
        self.value = 0.571040

    def change_value(self):
        self.value += 1
        print(f"Divergence Meter changed to {self.value}")


class GameStory:
    def __init__(self, labomen, microwave, crt_tv):
        self.labomen = labomen
        self.microwave = microwave
        self.crt_tv = crt_tv
        self.divergence_meter = []

    def send_message_to_change_divergence_meter(self):
        if self.microwave.is_on and self.crtTv.is_on:
            print(f"{self.labomen.name}: I want to change the world")
            self.crt_tv.receive_message("World change request")
            self.divergence_meter.append()
        else:
            print("Seems like nothing has changed.....")
   
   

# Create instances
microwave = Microwave()
crt_tv = CrtTv()

# Instantiate GameStory with the first Labotory instance
game_story = GameStory(Labomen[0], microwave, crt_tv)

# Call the method on the GameStory instance
game_story.send_message_to_change_divergence_meter()
 
amazon_data = [
    {"id": 100, "is_prime": False, "monthly_spend": 800.0},
    {"id": 101, "is_prime": True, "monthly_spend": 1500.0},
    {"id": 102, "is_prime": False, "monthly_spend": 1000.0},
    {"id": 103, "is_prime": True, "monthly_spend": 2350.0},
    {"id": 104, "is_prime": False, "monthly_spend": 1100.0},
    {"id": 105, "is_prime": True, "monthly_spend": 900.0},
    {"id": 106, "is_prime": False, "monthly_spend": 2300.0},
    {"id": 107, "is_prime": True, "monthly_spend": 1050.0},
    {"id": 108, "is_prime": False, "monthly_spend": 950.0},
    {"id": 109, "is_prime": True, "monthly_spend": 1250.0},
    {"id": 110, "is_prime": False, "monthly_spend": 1150.0},
    {"id": 111, "is_prime": True, "monthly_spend": 1400.0},
    {"id": 112, "is_prime": False, "monthly_spend": 1000.0},
    {"id": 113, "is_prime": True, "monthly_spend": 1100.0},
    {"id": 114, "is_prime": False, "monthly_spend": 950.0},
    {"id": 115, "is_prime": True, "monthly_spend": 1200.0},
    {"id": 116, "is_prime": False, "monthly_spend": 4444.0},
    {"id": 117, "is_prime": True, "monthly_spend": 4300.0},
    {"id": 118, "is_prime": False, "monthly_spend": 1400.0},
    {"id": 119, "is_prime": True, "monthly_spend": 900.0}
]

prime_membership_set = set()
non_prime_customer = set()
high_spenders = set()
med_spenders = set()
low_spenders = set()
#멤버쉽을 가진 사람을 위해 세트를 만듭니다. set()는 앞으로 이 것들이 set으로 사용될것을 지칭합니다.

for customer in amazon_data:
    if customer["is_prime"]:
        prime_membership_set.add(customer["id"])
    else:
        non_prime_customer.add(customer["id"])
#set를 말합니다

for customer in amazon_data:
    if customer["monthly_spend"] > 2000:
        high_spenders.add(customer["id"])
    elif customer ["monthly_spend"] < 2000 and customer ["monthly_spend"] > 1000:
        med_spenders.add(customer["id"])
    else:
        low_spenders.add(customer["id"])

       
print(prime_membership_set)
print(non_prime_customer)
print(high_spenders)
print(low_spenders)
print(med_spenders)
 
 
 
쉽게 구분이 되었네용

매일같이 글을 하나 포스팅하는 것을 습관을 두는 이유는 여러 가지 이유가 있는데, 첫째로는 글쓰기를 하나의 습관으로 함으로써 글의 모양새나 논리적 흐름을 좀 더 결연성 있게 하고자 함이요. 두 번째로는 머릿속 다양한 생각을 일단 글을 적으면서 정리하면서 내 심신에 위안을 바라는 것이고, 세 번째로는 미래에서 과거를 바라봤을 때 내가 이런 생각을 하고 살았구나 하는 깨달음을 주기 위함.

 

매일 아침마다 일어나서 학교에 가서 공부를 하고 있는데, 한국에서 대학교를 다녔던 시절에도 이렇게 까지 공부는 하지 않았던 것같다. 만일 그런 적이 있었다면, 대학교 시절로 돌아가는 것이 아니라 고등학교 시절로 돌아가야 할 정도니까. 이 글을 쓰면서 또 생각이 난 건데 무의미한 것들은 없는 거 같다. 내가 유의미하다고 생각하고 공부한 것보다, 무의미하다고 생각했던 것들이 큰 도움이 된 게 인생에서 더 많았던 거 같으니까. 

 

학업이 바쁘게 돌아가느라 이쁘게 찍은 사진을 아쉽게도 많이 존재하지 않고있는데, 그렇다고 해서 "잘"하고 있느냐를 묻는다면 그것도 아니다. 설명을 해주자면, 필자는 Business를 정말 싫어한다. Business System이라는 과목에서 하기 싫은 공부임에도 꾹 참고 꾸역꾸역 통과만 받으려고 하는 중이다. 개발자의 길을 간다면, 아무래도 개발이라는 개념을 넓게 확장할 필요가 있어, (프로그램이라는 것이 항상 핸드폰앱 같은 것을 말하는 것이 아니라 사무자동화나 아님 내부 시스템에서도 필요시 되니까) 그 개념을 공부하는 거라는 취지는 100번 동의해도 부족함이 없다. 이 개념을 알고 있느냐 없느냐는 나중에 업무 실무 개념에서 큰 차이를 만들어내니까.

 

그럼에도 불구하고, 최근의 대학교 학업에서 이런 지루한것들이 너무나도 싫었다. 다른반면으로는, 프로그램의 언어를 사용한다는 것은 날 즐겁고 행복하게 만드는 것은 사실이다. 내 이야기와 내 생각을 컴퓨터에게 입력하고 보이지 않지만 그 언어가 다른 개념과 연동되어 새로운 것을 만들어내고 또한 다른 사용자들의 언어를 보는 것은 날 즐겁게 만든다. 내가 외국어를 배우는 즐거움의 동기부여와 프로그램 언어를 배우는 동기부여는 그 근간을 같이 하기에, 언어의 조화와 결론을 내고 그 결론을 확장해 내가 생성한 Object를 만드는 건 너무 행복한 일이지만, Business는 싫다. 싫고 난해하고, 사람을 사람으로 보지 않고 돈으로 밖에 생각하지 않는 것이 싫은것도 사실인지라.

 

뭔가 경영이고 사업을 배운다는 것은 돈을 공부하는 것이고 결국 손익관계로 사람을 대한다는 것인데, 너무 인간미가없지 않은가. 물론 살다가 보면 그 생각이 당연해지는 순간이 반복적으로 오고, 그 순간이 모여 어느새 사회에 찌든 어른이 되는걸 수 도 있는 것은 사실이다. 이러한 관점은 생텍쥐 페리의 어린 왕자를 그리워하는 나의 모습인지는 잘 모르겠다. 무엇이 되었던, 지금도 마찬가지로, 만약에 3년 뒤에 내가 다시 이 글을 읽으면서 취업을 준비하고 있던, 취업을 해있던 어떠한 위치에서 이 것을 보려는지 모르겠는데, 제발 부탁이 건데, 너가 공부를 시작했고 그 길을 가겠다고 했던 그 마음은 변하지 말아 다오.  지난 5년동안의 두려움을 반복해하지 말고 군대에서 얻은 용기와 초심을 잃지 말아주고, 스스로 강인해져 약한 사람을 사랑하는 사람이 되었으면 한다. 

 

 내가 배움을 계속해야하는 이유또한 그렇다, 스스로의 발전을 중요시 여기는 것도 중요하지만, 인류애를 잊지 말았으면 한다. 내가 처음, 10살 남짓의 마음으로 의사가 되겠다 마음 먹었던 그 기억과 감정의 선이 한없이 연결되어 그때 당시의 가능성을 생각하면 처량해진 지금의 신세와 잃어버린 꿈을 쫓지못하고 현실과 타협해 다른 학문적 사랑을 찾은 마음은 눈물이 안나올수야 없는 아련해지는 것은 사실이긴 하다.  

 

 20대 후반이 되고 나서야 깨달은 것은 지나간 것은 지나간 대로 아름답다, 또한 지나가고 나서야 아름다운 것들도 있다. 돌아오지 않는 사랑이 있어야 그 이후의 내 성장을 만들어주고, 오는 사람막지 않고 떠나는 사람 막지 않는것이 때로는 현명함을 안다. "사람마다 받아들이는 세상이 다르고, 보는 세상이 다르다." 라는 오랜 문장은 이제 와서야 나에게 깨달음을 크게 주고있다. 아련하기도하고 처량하기도 해, 눈물이 앞을 가리는 듯하지만은 긍정적인 요소는 매번 존재한다. 이후에 이 글을 다시 읽는 내가 새로운 깨달음을 다시 얻을걸 생각하면 또 마음 한편으로 설레기도 한다. 그것이 존재한다는 것은, 결국에는 내가 지금 겪는 고뇌또한 이겨낸 내 자신이 존재한다는 증거니까.

 

무튼 오늘 일기 끝.

 

이 글을 끝으로 해야할 과제도있고

보고싶은 사람도 많다.

그럴때마다 몇몇번은 더 이상 보지 못하는 곳에 있어 수신자가 없는 곳으로 메세지를 남길때도 많다.

없는 사람을 그리워 한다는 것은 말이 안되는 것이 현실주의 적 관점으로 이해가 안되고 말도 안되는 일이지만,

난 아직도 그리운걸 

 

 

 

 

 

 

 

 

 

 

 

+ Recent posts