새 값을 다시 할당하는 것을 잊었습니다.
timeInSeconds = 1823
timeInMinutes = timeInSeconds / 60
timeInRest = timeInSeconds % 60
timeInMinutes = str(timeInMinutes)
timeInRest = str(timeInRest)
print("Your time in minutes and seconds is " + timeInMinutes + ":" + timeInRest)
기본적으로 이렇게 :
str(timeInMinutes)
TimeInMinutes 변수가 이제 문자열이라는 의미는 아닙니다. 다음과 같이 다시 할당해야합니다.
timeInMinutes = str(timeInMinutes)
나는 이것이 당신이 의도 한 것이라고 믿습니다.
그러나 나중에 int 값을 유지하는 것이 유용 할 수 있습니다. 이 경우 다음과 같이 새 변수를 만들 수 있습니다.
timeInMinutesStr = str(timeInMinutes)
timeInRestStr = str(timeInRest)
print("Your time in minutes and seconds is " + timeInMinutesStr + ":" + timeInRestStr)
또는 나중에 사용하지 않을 새 변수를 할당 할 필요가 없도록 인쇄에서 직접 값을 변환 할 수 있습니다.
print("Your time in minutes and seconds is " + str(timeInMinutes) + ":" + str(timeInRest))
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다