Join Regular Classroom : Visit ClassroomTech

Coding Questions | Find Total Feet | Codewindow.in

Given an array of integers representing measurement in inches, wrote a program to calculate the total measurement in feet. Ignore the measurements those are less than a feet (e.g. 10)

Example:
Input:
5
18 11 27 12 14

Output:
5

Explanation:
The first parameter is the size of the array. Next is an array of measurement in inches. The total number of feet is 5 which is calculated as under:
15–>1
11–>0
27–>2
12–>1
14–>1

Solution: In Python 3

n=int(input())
l=list(map(int,input().split()))
sum=0
for i in l:
    sum+=i//12
print(sum)
You Missed
Also Checkout