전체 글

코딩을 공부하는 대학생입니다. https://github.com/Hyeri1ee
· 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..
x = int(input("키 값을 입력하세요 :")) y = input("성별을 입력하세요(여/남) : ") def std_weight(k,s): if(s == "여"): return ((k / 100)*(k/100) )* 21 else: return ((k/100)*(k/100) )* 22 print("키 {0}cm {1}자의 표준 체중은 {2: .2f}kg 입니다.".format(str(x),str(y),std_weight(x,y)))
· 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))
#튜플 (속도가 list보다 빠름) menu = ("돈까스","치즈까스") print(menu[0]) print(menu[1]) #튜플 (name, age, hobby) = ("김종국" , 20, "코딩") print(name, age, hobby) #=============================== #set (집합) #중복안됨, 순서없음 set = {1,2,3,3,3} print(set) java = {"유재석","김태호","양세호"} python = set(["유재석", "박명수"]) #교집합 print(java & python) print(java.intersection(python)) #합집합 print(java | python) print(java.union(python)) #차집합 pr..
코딩신생아(0o0)
코딩신생아