로딩
요청 처리 중입니다...

해커랭크 Practice Python: Division

 해커랭크 Practice Python: Division

문제 Read two integers and print two lines. The first line should contain integer division, // .

The second line should contain float division, /. You don't need to perform any rounding or formatting operations.

풀이 if __name__ == '__main__': a = int(input()) b = int(input()) print (a%b) print (a/b) 파이썬에서 %를 쓰면 소숫점 아래 수가 없는 나눗셈. /를 쓰면 소수까지 계산되는 나눗셈.

아래 링크 참고 https://dpdpwl.tistory.com/93 [Python]파이썬 몫,나머지 구하기(/,%,divmod) 많은 언어에서 몫과 나머지를 구할때, /와 %를 사용하여 구한다. 파이썬에서는 divmod를 사용하여 몫과 나머지를 한번에 구할 수 있다. ...