11 days
페이지 정보
작성자 개발관리자 작성일 22-05-11 15:49 조회 114 댓글 0본문
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)
#Quiz 2:22:51
from random import *
guests = range(1,51)
guests = list(guests)
guests = [randrange(1,51) for i in guests]
print(guests)
matchs = range(1, 51)
match_tot = 0
for match_no in matchs:
if 5 <= guests[match_no-1] <=15 :
print("[O] {0}번째 손님 (소요시간 : {1}분)".format(match_no, guests[match_no-1]))
match_tot += 1
else:
print("[ ] {0}번째 손님 (소요시간 : {1}분)".format(match_no, guests[match_no-1]))
print("총 탑승 승객 : {}분".format(match_tot))
cnt = 0
for i in range(1, 51):
time = randrange(1, 51)
if 5<= time <= 15:
print("[O] {0}번째 손님 (소요시간 : {1}분)".format(i, time))
cnt+=1
else:
print("[ ] {0}번째 손님 (소요시간 : {1}분)".format(i, time))
print("총 탑승 승객 : {}분".format(cnt))
def open_account():
print("새로운 계좌가 생성되었습니다.")
open_account()
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
return commission, balance - money - commission
balance = 0
balance = deposit(balance, 1000)
withdraw(balance, 2000)
withdraw(balance, 500)
commission, balance = withdraw_night(balance, 500)
print ("수수료 {0} 원이며, 잔액은 {1} 원입니다.".format(commission, balance))
def profile(name, age=17, main_lang="파이썬"):
print("이름 : {0}\t나이 : {1}\t주 사용 언어 : {2}" \
.format(name, age, main_lang))
profile("유재석", 20, "파이썬")
profile("김태호", 25, "파이썬")
profile("이세호")
#key word
def profile(name, age, main_lang):
print(name, age, main_lang)
profile(name="유재석", main_lang="파이썬", age=20)
profile(main_lang="파이썬", age=20, name="유재석")
def profilem(name, age, lang1, lang2, lang3, lang4, lang5):
print("이름 : {0}\t나이 : {1}\t".format(name, age), end=" ")
print(lang1, lang2, lang3, lang4, lang5)
profilem("유재석", 20, "Python", "Java","C", "C++", "C#")
profilem("김태호", 25, "Python", "Java"," ", " ", "")
# 가변인자
def profilev(name, age, *language):
print("이름 : {0}\t나이 : {1}\t".format(name, age), end=" ")
for lang in language:
print(lang, end="")
print()
profilem("유재석", 20, "Python", "Java","C", "C++", "C#")
profilem("김태호", 25, "Python", "Java"," ", " ", "")
#지역변수, 전역변수
gun = 10
def checkpoint(soliders):
global gun
gun = gun - soliders
print ("[함수 내] 남은 총 : {0}".format(gun))
print("전체 총 : {0}".format(gun))
checkpoint(2) #2명이
print("전체 총 : {0}".format(gun))
checkpoint(2)
def checkpoint_ret(gun, soliders):
gun = gun - soliders
print ("[함수 내] 남은 총 : {0}".format(gun))
return gun
print("전체 총 : {0}".format(gun))
gun = checkpoint_ret(gun, 2)
print("전체 총 : {0}".format(gun))
quiz 2:53:59
def std_weight(height, gender):
if gender == "남자":
return height * height * 22
else:
return height * height * 21
height = 175
gender = "남자"
weight = round(std_weight(height / 100, gender),2)
print("키 {0}cm {1}의 표준 체중은 {2}kg 입니다.".format(height, gender, weight))
print("Python", "Java", sep=" vs ")
print("Python", "Java", sep=",", end="?")
print("Python", "Java")
import sys
print("Python", "Java", file=sys.stdout)
print("Python", "Java", file=sys.stderr)
scores = {"수학":0, "영어":50, "코딩":100}
for subject, score in scores.items():
print(subject.ljust(8), str(score).rjust(4), sep=":")
# 은행 대기표
for num in range(1, 21):
print("대기번호 : " + str(num).zfill(3))
answer = input("아무 값이나 입력하세요. : ")
print("입력하신 값은 " + answer + "입니다.")
print(type(answer))
https://github.com/dlcjsdltlq/pokemon-bread-macro
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)
#Quiz 2:22:51
from random import *
guests = range(1,51)
guests = list(guests)
guests = [randrange(1,51) for i in guests]
print(guests)
matchs = range(1, 51)
match_tot = 0
for match_no in matchs:
if 5 <= guests[match_no-1] <=15 :
print("[O] {0}번째 손님 (소요시간 : {1}분)".format(match_no, guests[match_no-1]))
match_tot += 1
else:
print("[ ] {0}번째 손님 (소요시간 : {1}분)".format(match_no, guests[match_no-1]))
print("총 탑승 승객 : {}분".format(match_tot))
cnt = 0
for i in range(1, 51):
time = randrange(1, 51)
if 5<= time <= 15:
print("[O] {0}번째 손님 (소요시간 : {1}분)".format(i, time))
cnt+=1
else:
print("[ ] {0}번째 손님 (소요시간 : {1}분)".format(i, time))
print("총 탑승 승객 : {}분".format(cnt))
def open_account():
print("새로운 계좌가 생성되었습니다.")
open_account()
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
return commission, balance - money - commission
balance = 0
balance = deposit(balance, 1000)
withdraw(balance, 2000)
withdraw(balance, 500)
commission, balance = withdraw_night(balance, 500)
print ("수수료 {0} 원이며, 잔액은 {1} 원입니다.".format(commission, balance))
def profile(name, age=17, main_lang="파이썬"):
print("이름 : {0}\t나이 : {1}\t주 사용 언어 : {2}" \
.format(name, age, main_lang))
profile("유재석", 20, "파이썬")
profile("김태호", 25, "파이썬")
profile("이세호")
#key word
def profile(name, age, main_lang):
print(name, age, main_lang)
profile(name="유재석", main_lang="파이썬", age=20)
profile(main_lang="파이썬", age=20, name="유재석")
def profilem(name, age, lang1, lang2, lang3, lang4, lang5):
print("이름 : {0}\t나이 : {1}\t".format(name, age), end=" ")
print(lang1, lang2, lang3, lang4, lang5)
profilem("유재석", 20, "Python", "Java","C", "C++", "C#")
profilem("김태호", 25, "Python", "Java"," ", " ", "")
# 가변인자
def profilev(name, age, *language):
print("이름 : {0}\t나이 : {1}\t".format(name, age), end=" ")
for lang in language:
print(lang, end="")
print()
profilem("유재석", 20, "Python", "Java","C", "C++", "C#")
profilem("김태호", 25, "Python", "Java"," ", " ", "")
#지역변수, 전역변수
gun = 10
def checkpoint(soliders):
global gun
gun = gun - soliders
print ("[함수 내] 남은 총 : {0}".format(gun))
print("전체 총 : {0}".format(gun))
checkpoint(2) #2명이
print("전체 총 : {0}".format(gun))
checkpoint(2)
def checkpoint_ret(gun, soliders):
gun = gun - soliders
print ("[함수 내] 남은 총 : {0}".format(gun))
return gun
print("전체 총 : {0}".format(gun))
gun = checkpoint_ret(gun, 2)
print("전체 총 : {0}".format(gun))
quiz 2:53:59
def std_weight(height, gender):
if gender == "남자":
return height * height * 22
else:
return height * height * 21
height = 175
gender = "남자"
weight = round(std_weight(height / 100, gender),2)
print("키 {0}cm {1}의 표준 체중은 {2}kg 입니다.".format(height, gender, weight))
print("Python", "Java", sep=" vs ")
print("Python", "Java", sep=",", end="?")
print("Python", "Java")
import sys
print("Python", "Java", file=sys.stdout)
print("Python", "Java", file=sys.stderr)
scores = {"수학":0, "영어":50, "코딩":100}
for subject, score in scores.items():
print(subject.ljust(8), str(score).rjust(4), sep=":")
# 은행 대기표
for num in range(1, 21):
print("대기번호 : " + str(num).zfill(3))
answer = input("아무 값이나 입력하세요. : ")
print("입력하신 값은 " + answer + "입니다.")
print(type(answer))
https://github.com/dlcjsdltlq/pokemon-bread-macro
댓글목록 0
등록된 댓글이 없습니다.




