목록분류 전체보기 (214)
개발로그필름
for waiting_no in [0, 1, 2, 3, 4]: print("대기번호 : {0}".format(waiting_no)) for waiting_no in range(5): # 0, 1, 2, 3, 4 print("대기번호 : {0}".format(waiting_no)) for waiting_no in range(1, 6): # 1, 2, 3, 4, 5 print("대기번호 : {0}".format(waiting_no)) starbucks = ["아이언맨", "토르", "아이엠 그루트"] for customer in starbucks: print("{0}, 커피가 준비되었습니다.".format(customer))
# while customer = "토르" index = 5 while index >= 1: print("{0}, 커피가 준비 되었습니다. {1}번 남았어요.".format(customer, index)) index -= 1 if index == 0: print("커피는 폐기처분 되었습니다.") # 무한루프 customer = "아이언맨" index = 10 while True: print("{0}, 커피가 준비되었습니다. 호출 {1}회".format(customer, index)) index += 1 customer = "토르" person = "Unknown" while person != customer : print("{0}, 커피가 준비 되었습니다.".format(customer)) person ..
def open_accout(): print("새로운 계좌가 생성되었습니다.") def deposit(balance, money): # 입금 print("입금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance + money)) return balance + money def withdraw(balance, money): # 출금 if balance >= money: # 잔액이 출금보다 많으면 print("출금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance - money)) return balance - money else: print("출금이 완료되지 않았습니다. 잔액은 {0}원 입니다.".format(balance)) return balance def wi..
WebMarket/WebContent/Welcome.jsp WebMarket/WebContent/menu.jsp Home WebMarket/WebContent/footer.jsp © WebMarket
WebMarket/WebContent/welcome.jsp Home © WebMarket
# 기본값 def profile(name, age, main_lang): print("이름 : {0}\t나이 : {1}\t주 사용 언어: {2}".format(name, age, main_lang)) profile("유재석", 20, "파이썬") profile("김태호", 25, "자바") # 같은 학교 같은 학년 같은 반 같은 수업. def profile(name, age=17, main_lang="파이썬"): print("이름 : {0}\t나이 : {1}\t주 사용 언어 : {2}".format(name, age, main_lang)) profile("유재석") profile("김태호") # 키워드 값 def profile(name, age, main_lang): print(name, age, mai..
from random import * print(random()) # 0.0 ~ 1.0 미만의 임의의 값 생성 print(random() * 10) # 0.0 ~ 10.0 미만의 임의의 값 생성 print(int(random() * 10)) # 0 ~ 10 미만의 임의의 값 생성 print(int(random() * 10)) # 0 ~ 10 미만의 임의의 값 생성 print(int(random() * 10)) # 0 ~ 10 미만의 임의의 값 생성 print(int(random() * 10) + 1) # 1 ~ 10 이하의 임의의 값 생성 print(int(random() * 10) + 1) # 1 ~ 10 이하의 임의의 값 생성 print(int(random() * 10) + 1) # 1 ~ 10 이하..
print("a" + "b") # ab print("a", "b") # a b # 방법 1 print("나는 %d살입니다." % 20) print("나는 %s을 좋아해요." % "파이썬") print("Apple은 %c로 시작해요." % "A") # %s print("나는 %s살입니다." % 20) print("나는 %s색과 %s색을 좋아해요." % ("파란", "빨간")) # 방법 2 print("나는 {}살 입니다.".format(20)) print("나는 {}색과 {}색을 좋아해요.".format("파란", "빨간")) print("나는 {0}색과 {1}색을 좋아해요.".format("파란", "빨간")) print("나는 {1}색과 {0}색을 좋아해요.".format("파란", "빨간")) # 방..