+ 1
Chear creater from code coach why test 3 and 4 not working
yards=float(int(input(""))) def distance(yards): if yards>10: return "high five" elif yards<=1: return "shh" elif yards<=10: return "Ra!" else: return "what" print(distance(yards))
4 Réponses
+ 10
But it's python 🐍
yards=int(input(""))
def distance(yards):
if yards>10:
return "High Five"
elif yards<=1:
return "shh"
elif yards<=10:
return "Ra!"*yards
'''else:
return "what"
'''
print(distance(yards))
+ 3
i completed that task
Thankyou for your help bro😀
+ 2
"""
you probably need to return "shh" if yards is strictly lesser than 1...
if you first convert input to int, you don't need to convert it to float (or use only float, without converting to int)...
you don't need last else statement and you could replace last elif (and condition) statement with simple else...
and you need to return "Ra!" how many times that yards is given (so, yards must be int, not float) ;)
"""
yards = int(input())
def distance(yards):
if yards>10:
return "high five"
elif yards<1:
return "shh"
else:
return "Ra!"*yards
print(distance(yards))
0
I don't know what is the code coach task, and no more what are each tests...
anyway, I guess that code coaches have hidden tests...
(I don't have access to code coaches with the version of sololearn app I use ^^)