모두를위한프로그래밍2 모두를 위한 프로그래밍 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 다음