Working with functions
In the same way as with variables, you can declare your own functions and then use them in the notebook.
Oppgave
Swipe to start coding
- Replace
...
with the necessary calculation. Remember, your function needs to convert number of seconds to days. - Replace
...
with the name of function and name of variable you created before.
Løsning
9
1
2
3
4
5
6
# create function
def days_from_second(sec):
return(sec/86400)
# test function
print("There are",days_from_second(sec_in_week),"days in", sec_in_week, "seconds")
Mark tasks as Completed
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 3
single
9
1
taskCode
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår