01. Circuit Analysis(Basic Input/Output)
01. Circuit Analysis(Basic Input/Output)
[toc]
2022-09-13 회로이론 과제
파이썬으로 학번, 이름, 입학년도, 휴학 여부 입력 받아서 한 문장으로 출력하기
코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
a = input('What is your name? ')
b = input('What is your Student ID? ')
c = input('When did you enroll the University? ')
d = input('Are you taking a break from school? ')
e = int(c) + 4
if c == '2022':
c = '1st'
elif c == '2021':
c = '2nd'
elif c == '2020':
c = '3nd'
else:
c = '4th'
if d == 'Y':
f = int(input('How long do you want to take a break from the shcool ? '))
print('%s, %s, you are %s year student in this year, aren’t you? You may graduate on February %s year.' % (a, b, c, e + f))
elif d == 'N':
print('%s, %s, you are %s year student in this year, aren’t you? You may graduate on February %s year.' % (a, b, c, e))
결과
1
2
3
4
5
6
7
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What is your name? YoungHoon Ko
What is your Student ID? abcdef
When did you enroll the University? 2022
Are you taking a break from school? N
YoungHoon Ko, (abcdef), you are 1st year student in this year, aren’t you? You may graduate on February 2026 year.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~