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

제목lecture7 conditionalstatement 첫 실습문제 질문입니다.2022-04-21 21:22
작성자
userInput = input(prompt="Enter integet (1..9): ")
userInput = int(userInput)

if (userInput >= 1) and (userInput <=9) : # Grammar.1
    print("Your input is " + str(userInput))
    print("Right input and execute program.")
else: # Grammar.2
    print("Your input is " + str(userInput))
    print("Wrong input and terminate program.")

여기서 3.2와 같은 float형 수를 input하니까 오류가 뜨더라구요
혹시 float형 수를 입력해서 인가요??

두번째 줄의 int형으로 바꿔준다는 문장떄문에 float형을 입력해도 실행될거라 생각했는데 어느 부분에서
오류가 생겼는지 알려주시면 감사드리겠습니다.
댓글
이전[re]질문입니다.2022-04-22
다음[re]lecture7 conditionalstatement 첫 실습문제 질문입니다.2022-04-21