#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http

제목질문드립니다2022-03-25 23:22
작성자

실습과정에서,

def makeBirthdaystring(x):

    birthyear = int(x[0:2]) + 1900

    birthmonth = int(x[2:4])

    birthday = int(x[4:6])

    strAnswer = "당신의 생일은 " + str(birthyear) + "년" + str(birthmonth) + "월" + str(birthday) + "일 입니다"

    return strAnswer

userinput = input(prompt= "주민등록번호 앞자리 6자리를 입력해 주세요: ") 중에서 



질문 1. +1900 은 왜 써주는건가요?

질문 2. [  ] 안에 숫자는 왜써주는건가요? 각 변수에 두자리씩 끊어들어가기 때문일까요?

질문3. 프린트실행시 "주민등록번호 앞자리 6자리를 입력해주세요" 가 먼저 나오니 userinput 변수를 먼저 꼭  입력해야 할 필요가 있는건 아닌건가요?

댓글
이전[re]파이썬 조건문 실습 과제2022-03-26
다음[re]질문드립니다2022-03-26