파이썬 사용할때 필요한 깨알 팁
1. print할때 tab 효과 [일반] print("my name is, hontube") [명령문] 결과: 2. 서로 다른 print 문 한줄에 보이기 [명령문] print("my name is, hontube", end=" ") print("my name is,\t hontube") 결과: 3. 문자열 사이에 ',' 'vs'등과 같은 string 넣기 [명령문] print("my name is", "hontube", "I love it", sep=" vs ") 결과: 4. 표준출력(log용) [명령문] import sys print("my name is", "success", file=sys.stdout) // 정상동작일 경우 출력됨 print("my name is", "success", file=..
더보기
Class 개념이해를 위한 간단한 퀴즈 풀어보기
문제. 주어진 코드를 활용하여 부동산 프로그램을 작성하시오. (문제 출처 : 유튜버-나도코딩) #출력예제 [sample code] class House: #매물 초기화 def __init__(self, location, house_type, deal_type, price, completion_year): pass #매물 정보 표시 def show_detail(self): pass . . . . . . . . . . . . . . . . . . . . . . . . . . . [정답] class House: #매물 초기화 def __init__(self, location, house_type, deal_type, price, completion_year): self.location = location se..
더보기