0
I don’t know what i’m missing out why my code is not running, I’m i expecting my code to ask for input from user.
from datetime import datetime from playsound import playsound time = datetime.now() x = int(input()) print(x) def tea(): if x > 100: return ("water is boiling + datetime.now()") playsound("Westlife_My_Love.mp3") else: return("should i start boiling the water sir! + datetime.now()") playsound("Westlife_My_Love.mp3") if x >= 101: return("water is will be too hot to drink sir! + datetime.now()") playsound("Westlife_My_Love.mp3")
5 odpowiedzi
+ 3
JaScript after return no more code will be processed
+ 2
# it is ok, after some modification as follows:
from datetime import datetime
from playsound import playsound
time = datetime.now()
x = int(input())
print(x)
def tea():
if x > 100:
print("water is boiling " + str(datetime.now()))
playsound("Westlife_My_Love.mp3")
else:
print("should i start boiling the water sir! " + str(datetime.now()))
playsound("Westlife_My_Love.mp3")
if x >= 101:
print("water is will be too hot to drink sir! " + str(datetime.now()))
playsound("Westlife_My_Love.mp3")
tea()
+ 1
Of course Oma Falk . Oluwadamilare Awe import does not work here that's why I first turned off above and ignored below. You're right, that still owes a clarification.
+ 1
Oluwadamilare Awe I have updated my answer above. Unfortunstelly I did not get an example which works on Sololearn Playground with a sound from dropbox.
Short explanation:
1. You coded / defined a function tea() but you did not run it. This do the last row in the example above.
2. After return cannot be more processed. Instead return you can print the message and let that whole easy.
0
I sent you a direct message please check to be able to clarify It between that's my first time trying to create a program do you think it great?