파이썬11 모두를 위한 프로그래밍 7주차 for 문을 이용하는 강의 파이썬은 복수형을 이해하지 못하기 때문에 아래 예시에서는 리스트 형으로 이해하여 오른쪽 처럼 출력하게 하게 된다 과제 5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. En.. 2022. 1. 13. 모두를 위한 프로그래밍 6주차 <함수> 4.6 퀴즈 4.6 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay should be the normal rate for hours up to 40 and time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to do the computation of pay in a function called computepay() and use the function to do the computation. The function should return a value. Use 45 .. 2022. 1. 13. 모두를 위한 프로그래밍 5주차 노란 코드에서는 'Something else' 문장이 오렌지 코드에서는 'Below 10' 문장이 출력되지 않는다 이미 위 'Below 20' 문장이 사실 값이 되었기 때문 이러한 코드에서 계속해서 코드를 진행시키기 싶거나 혹은 traceback을 발생시키기 싫다면 ? try와 execpt 를 사용하면 된다. 첫 try 문장에선 정수 값이여서 firtst -1 로 결과가 나오고 두번째 try 문장에선 정수형이여서 제대로된 결과를 볼 수 있다. 일반적인 decision은 if를 사용하고 양뱡향의 decisions는 if - then - else를 동반함 try/execpt는 원하는 에러를 찾는데 사용된다고 생각하면 된다. 2022. 1. 12. 이전 1 2 다음