Python10 [인프런]함수 기본개념 def open_account(): 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)) else : print("출금이 완료되지 않았습니다. 잔액은 {0}원입니다.".format(balance)) return balance - money def withdraw_night(balance, money): commision = 200 .. 2022. 2. 25. [인프런]퀴즈#5(제어문) from random import * cnt = 0 for i in range(1,51) : time = randrange(5,51) if 5 2022. 2. 25. [인프런]리스트, 사전, 튜플, 세트, 자료구조 변경 list .index : 위치 찾기 .append : 끝에 더하기 .insert(값,위치) : 사이에 넣기 .pop : 뒤에서 하나씩 빼기 .count("값") : 같은 게 몇 개 있는지 확인 .sort() : 정렬 .reverse() : 반대로 .clear() : 다 지우기 .extend(리스트 이름) : 리스트 확장 dictionary dic = {key : value, key : value} value 나옴 cabinet.get True 혹은 False 변수[새로운 key] = 새로운 value del 변수[지울 key] 변수.keys() -> key들만 출력 / 변수.values() -> value들만 출력 / 변수.items() -> 둘 다 출력 tuple 변수 = (value1, value2) 2022. 2. 25. [CLASS101] AI자동투자봇 만들기]파이썬 기초문법② module : 함수, 변수, 클래스 포함한 파이썬 파일 / package : module 묶음 / library : package 묶음 import math # math 라는 모듈에서 sqrt 라는 함수를 선택한 것. a1 = math.sqrt(9) print(a1) ////////////////////////////////////////// from math import sqrt # sqrt 앞에 math. 을 쓰지 않아도 바로 사용 가능 a2 = sqrt(9) print(a2) 2022. 2. 24. 이전 1 2 3 다음