#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http 제목기말 기출 코드좀 봐주실 수 있나요2020-06-16 16:28작성자제발 기말고사 문제를 풀었는데 __init__과 __eq__에서 syntax error가 발생하네요.. 아래의 링크는 발생한 오류들의 목록이고... 그 외의 함수 피드백좀 부탁드립니다.http://colorscripter.com/s/akxSCbW def get_integer(input):if (type(input) == int):return inputelif (type(input) == float):return int(input)elif (type(input) == str):try:return int(input)except:return 0 elif (isinstance(input, MyInteger)):return inputelse:return 0class MyInteger: current_value = [] press = 0 def __init__(self, input):self.current_value.append(get_integer(input))def __eq__(self, other): get_integer(other)return self.current_value[-1] == otherdef pressAdd(self, input): new_current = self.current_value[-1] + get_integer(input)self.current_value.append(new_current)self.press += 1 return self.current_value[-1]def PressSub(self, input): new_current = self.current_value[-1] - get_integer(input)self.current_value.append(new_current)self.press += 1 return self.current_value[-1]def getCurrentVariable(self, mode):if mode == None:return self.current_value[-1]elif mode == "hex": hex_current_value = '0x' + hex(self.current_value[-1])return hex_current_valueelif mode =="oct": oct_current_value = '0o' + oct(self.current_value[-1])return oct_current_valueelif mode =="bin": bin_current_value = '0b' + bin(self.current_value[-1])return bin_current_valueelse:return self.current_valuedef resetCurrentVariable(self):self.current_value.clear()self.current_value.append(0)return self.current_valuedef rollbackCurrentVariable(self):if self.press < 1:self.current_value[-1] = 0 else:self.current_value.pop()self.press -= 1 return self.current_value[-1] 목록수정삭제답변글쓰기 댓글 [1] 댓글작성자(*)비밀번호(*)내용(*) 댓글 등록 더보기이전입력 피라미터에 대해서 질문입니다.오후 4시 54분2020-06-16다음파이썬 스레드 이용 방식 혹은 다른 방식나도학생2020-06-16 Powered by MangBoard | 워드프레스 쇼핑몰 망보드