python

· python
# with open("study.txt","w",encoding = "utf8") as study_file: # study_file.write("파이썬을 열심히 공부하고 있어오.") # with open("study.txt","r",encoding = "utf8") as study_file: # print(study_file.read()) #quiz4 for i in range(1,51): with open(str(i) + " 주차.txt","w",encoding = "utf8") as report: report.write("- "+str(i) +" 주차 주간보고 -\n") report.write("부서 : \n") report.write("이름 : \n") report.write("업무 요약 : \n")
· python
import pickle profile_file = open("profile.pickle","wb") profile = {"이름" : "박명수", "나이" : 30, "취미" : ["축구", "골프","코딩"]} print("profile") pickle.dump(profile, profile_file) profile_file.close() profile_file = open("profile.pickle","rb") profile = pickle.load(profile_file) print(profile) profile_file.close()
· python
#정렬 scores = {"수학" : 0, "영어" : 50, "코딩" : 100} for subject,score in scores.items(): #print(subject , score) print(subject.ljust(8), str(score).rjust(4),sep = " : ") #은행 대기순번표 for num in range(1,21): print("대기번호 : "+str(num).zfill(3)) # score_file = open("score.txt","w",encoding ="utf8") # print("수학 : 0",file = score_file) # print("영어 : 50",file = score_file) # score_file.close() # score_file = o..
· python
#함수 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)) def withdraw_night(balance, money): #저녁에 출금 commission = 100 ret..
· python
#quiz from random import * count = 0 for i in range(50): x = randrange(5,51) if (x > 5 and x
· python
students = [1,2,3,4,5] print(students) students = [i+100 for i in students] print(students) students = ["iron man","thor","i am groot"] students = [len(i) for i in students] print(students) students = ["iron man","thor","i am groot"] students = [i.upper() for i in students] print(students)
· python
from random import * coffee = set() #coffee = {} 은 dict 형태 초기화 선언임. while(len(coffee)
· python
#자료구조 변경 menu = {"커피","우유","주스"} print(menu, type(menu)) menu = list(menu) print(menu, type(menu)) menu = tuple(menu) print(menu, type(menu)) menu = set(menu) print(menu, type(menu))
코딩신생아(0o0)
'python' 카테고리의 글 목록