[혼공파] 띠 계산 프로그램: 세 가지 구현 방식 비교
·
혼공학습단/혼공파
이 게시글은 혼공학습단(혼공파) 13기의 2주차 과제를 포함하고있습니다.1. if - elif 문을 활용한 구현str_input = input("태어난 해를 입력해주세요> ")birth_year = int(str_input)if birth_year % 12 == 0: print('원숭이 띠입니다.')elif birth_year % 12 == 1: print('닭 띠입니다.')elif birth_year % 12 == 2: print('개 띠입니다.')elif birth_year % 12 == 3: print('돼지 띠입니다.')elif birth_year % 12 == 4: print('쥐 띠입니다.')elif birth_year % 12 == 5: print('소 띠입니..
[혼공파] print 함수 톺아보기
·
혼공학습단/혼공파
이 게시글은 혼공학습단(혼공파) 13기의 1주차 과제를 포함하고있습니다. 1. print() 함수의 기본 사용법print() 함수는 값을 출력하기 위해 사용됩니다.print("안녕하세요, Python!") # 출력: 안녕하세요, Python!쉼표로 여러 값을 구분하여 출력할 수도 있습니다.print("이름:", "성호", "나이:", 25) # 출력: 이름: 성호 나이: 252. print() 함수의 파라미터help(print)Help on built-in function print in module builtins:print(*args, sep=' ', end='\n', file=None, flush=False) Prints the values to a stream, or to sys.stdout..