baemongs
@baemongs1002
수강평 작성수
-
평균평점
-
게시글
질문&답변
안녕하세요. 늦은시간에 죄송합니다.ㅠㅠ
감사합니다. ctrl+f5로 해도 똑같아요.ㅠㅠ 하지만 우상단 버튼으로 하니까 이런게 안나오네욯ㅎㅎ 이전까지는 이런게 안떴는데 갑자기 나타나서는 터미널에 길게 뜨는 것 때문에 내용들보다 더 크게 화면을 차지하니까 보기 싫더라고요;; f5로도 아예 안나오게 할 수 있는 방법은 없는거죠?
- 0
- 3
- 384
질문&답변
while이나 for 또는 if 같은 구문 조건에
print("Type your height in centimeter :",end=" ") height = input() while True: if str(0) str(400): break else: height = input("You can type only in number. Type your height in centimeter : ") 이렇게 해결했습니다!!
- 0
- 5
- 209
질문&답변
while이나 for 또는 if 같은 구문 조건에
선생님~ 퀴즈#6을 코딩하고 있는데요. 좀 더 구체적인 코딩을 하고 있는 중입니다. 사용자 입력으로 키를 입력받는 중에 사용자가 int가 아닌 다른 type의 엉뚱한 입력값을 넣으면 다시 입력받을 수 있는 방법은 없을까요? if type(height) != int: 다시 입력하도록 하는 코드 이런 느낌을 만들고 싶은데 잘 모르겠네요.. def std_weight(height, gender): if gender == "남자": std = pow(int(height)/100,2)*22 elif gender == "여자": std = pow(int(height)/100,2)*21 return round(std,2) # print("Type m if you are man, Type f if you are woman :",end=" ") choice = input("Type m if you are man, Type f if you are woman : ") while True: if choice == "m": gender = "남자" break elif choice == "f": gender = "여자" break else: print("You write wrong answer.") print("Type \"m\" or \"f\" only.") print("Type \"m\" if you are a man, type \"f\" if you are a woman :",end=" ") choice = input() print("Type your height in centimeter :",end=" ") height = input() while True: if 0 int(height) 400: break else: print("You can type only in number. Type your height in centimeter :", end=" ") height = input() print("키 {0}cm {1}의 표준 체중은 {2}kg 입니다.".format(height, gender, std_weight(height, gender))) . . . 여기까지 제가 작성한 코드구요. 잘못된 값을 입력하는 것때문에 동작이 멈추고 싶지는 않습니다. 아래는 height에 int가 아닌 값을 입력하면 나는 오류코드입니다. 너무 어려운걸 도전하고 있나요?ㅠㅠ . . Type m if you are man, Type f if you are woman : f Type your height in centimeter : qqq Traceback (most recent call last): File "c:/Users/인영/Desktop/PythonWorkSpace/helloworld.py", line 27, in if 0 ValueError: invalid literal for int() with base 10: 'qqq'
- 0
- 5
- 209
질문&답변
while이나 for 또는 if 같은 구문 조건에
와우 퀵실버만큼 빠른 답변 감사합니다! 이 방법으로 코딩해볼게요~ 될 것 같습니다. 감사합니다.
- 0
- 5
- 209




