# Need to complete this function only using return once

Hi i need to write this function and have it return the values but i cant stop it from return none after each one , im only aloud to use return once in the code can anyone help.

``````def  traffic_intensity(count):
if count in range(0, 5000):
print("very low")
elif count in range(5000, 10000):
print("low")
elif count in range(10000, 18000):
print("moderate")
elif count in range(18000,1000000):
print("high")
else:
return()
level = traffic_intensity(18000)
print(level)  #high
level = traffic_intensity(9999)
print(level)
level = traffic_intensity(5000)
print(level)
level = traffic_intensity(1000)
print(level)
``````

`None` is default value returned

In the different conditions (if and elif) set a variable to the desired value, then after the conditions return this variable. Then you have a single return

is there a way in code u could show me where im going wrong? i dont understand why i cant fix it

``````def  traffic_intensity(count):
x = ("very low")
c = ("low")
v = ("moderate")
b = ("high")
if count in range(0, 5000):
print(x)
elif count in range(5000, 10000):
print(c)
elif count in range(10000, 18000):
print(v)
elif count in range(18000,1000000):
print(b)
else:
return()
``````

that solution could work, if you where allowed to use multiple returns:

``````    if count in range(0, 5000):
return x
``````

but given you are not to use allow multiple returns, that won’t work

It should be a single variable, which is defined inside if/elif clause. So that the value of the variable depends on which condition clause executed

then at the end of the function, return this variable

ive tried this but now its saying it cant return int ? when im trying to return a string which i dont understand

``````def  traffic_intensity(count):
for num in count:
if num in range(0, 5000):
print("very low")
elif num in range(5000, 10000):
print("low")
elif num in range(10000, 17999):
print("moderate")
elif num in range(18000, 100000):
print("high")
else:
return()

level = traffic_intensity(18000)
print(level)  #high
level = traffic_intensity(9999)
print(level)
level = traffic_intensity(5000)
print(level)
level = traffic_intensity(1000)
print(level)
``````

finally got it ! thank you for the help

``````def  traffic_intensity(count):
a = (count)
if a <= 5000:
elif a >= 10000:
Good you figured it out 