0
나는 프로그램에 새로운 학생을 추가 할 것인지 묻는 질문을해야한다. 사용자 명령을 보관할 변수를 설정 한 후 : 예 (1) 인 경우 프로그램은 사용자에게 이름과 ID를 입력하도록 요청하고 그렇지 않은 경우 프로그램을 종료합니다.if 문이 실행되지 않는 이유는 무엇입니까?
students = []
def get_students_titleCase():
students_titleCase = []
for student in students:
students_titleCase = student["name"].title()
return students_titleCase
def print_students_titlecase():
students_titleCase = get_students_titleCase()
print(students_titleCase)
def add_student(name , student_id = 000):
student = {"name" : name , "student_id": student_id }
students.append(student)
user_command = input("Do You Want to Add a Student Name?\n1- Yes\n2- No\n")
#user_command = 1
if user_command == 1:
student_list = get_students_titleCase()
student_name = input("Enter Student Name: ")
student_id = input("Enter Student ID: ")
add_student(student_name, student_id)
print_students_titlecase()
'때문에 user_command' 같지 않은'1' (힌트 :'반환 input' 않는 것) –
하지만 1을 입력 하시겠습니까 ??? – ShaDiliX
하지만 [input'] (https://docs.python.org/3/library/functions.html#input)은 무엇을 제공합니까 ??? (여기에 다른 힌트가 있습니다 : 문서를 읽으십시오 ...) –