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")

18th Jun 2022, 2:44 PM
Dubbymore
Dubbymore - avatar
5 Antworten
+ 3
JaScript after return no more code will be processed
18th Jun 2022, 3:50 PM
Oma Falk
Oma Falk - avatar
+ 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()
18th Jun 2022, 3:15 PM
JaScript
JaScript - avatar
+ 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.
18th Jun 2022, 10:06 PM
JaScript
JaScript - avatar
+ 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.
18th Jun 2022, 11:34 PM
JaScript
JaScript - avatar
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?
18th Jun 2022, 10:08 PM
Dubbymore
Dubbymore - avatar