PS/Python
[Python] 백준 10797번(10부제) 문제 풀이
KwonYongHyeon
2022. 2. 18. 18:22
day = input()
cars = input().split()
print(cars.count(day))
리스트에서 특정 요소의 개수를 구하는 법은 저번에 다뤘었다.
https://developer-next-to-you.tistory.com/33
[Python] 리스트에서 특정 요소 개수 구하기
살다 보면, 가끔 리스트에서 특정 요소의 개수를 구하는 것이 필요할 때도 있고 하다. examples = [1, 1, 0, 0, 1, 0, 1] zeros = 0 for example in examples: if example == 0: zeros += 1 이렇게 코드를 작..
developer-next-to-you.tistory.com