# SLEEP - Editorial

Author: Jeevan Jyot Singh
Tester: Hriday
Editorialist: Nishank Suresh

348

None

# PROBLEM:

A person is said to be sleep-deprived if he sleeps strictly less than 7 hours in a day.
Given that someone sleeps for X hours, is he sleep-deprived?

# EXPLANATION:

Simply implement what the statement says using an if condition:

• If X \lt 7, then the person is sleep-deprived, so print “Yes”
• Otherwise, print “No”

# TIME COMPLEXITY

\mathcal{O}(1) per test case.

# CODE:

Editorialist's code (Python)
for _ in range(int(input())):
print('Yes' if int(input()) < 7 else 'No')


i made use of the while loop in solving this question but the compiler gives an error to the answer. attach is the code.

counter = 0

test_cases = int(input("how many test cases are you carrying out? "))

while counter < test_cases:

number_of_hours = int(input("how many hours did you sleep? "))

if number_of_hours < 7:

print("yes")

else:

print("no")

counter += 1

lst=[]
n=int(input())
for i in range(0,n):
ele=int(input())
lst.append(ele)
for i in lst:
if i<7:
print(“YES”)
else:
print(“NO”)
// simple code