Premium Only Content

Functions and User Input |Section 3|Celestial Warrior
The next lecture will be an exercise and there will be more exercises as you progress through the course.
The exercises are difficult and sometimes tricky and I don't expect students to solve them all. Most students actually fail to solve the exercisesunless they are already familiar with Python.
The whole point of exercises is to force you to think about how to solve a problem independently. The next lecture following each exercise contains the solution where you can compare your approach.
Create a functionthat converts Celsius degrees toFahrenheit. The formula to convert Celsius to Fahrenheit isF= C 9/5 + 32.
In the previous exercises you used the interactive Udemy interface to write your code.For this exercise, please use your computertools (Python, editor, terminal,etc.). This will help you get used with Python in a real environment.
Once you are done check your solution against my solution which islocatedin the next lecture. Don't worry if your solution is not exactly the same as mine. As far as the solutions generate the same output, your solution is most likely correct.
def cel_to_fahr(c):
f = c * 9/5 + 32
return f
And here is an example of calling the function:
print(cel_to_fahr(10))
That would return 50.0 which means 10 degreeCelsius is equal to 50 degreeFahrenheit.
Create a function that takes any string as argument and returns the length of that string.
def string_length(mystring):
return len(mystring)
And here's an example of calling the function:
print(string_length("Hello"))
That would return 5.
-
LIVE
Rallied
5 hours ago $0.22 earnedWarzone Solo Challenges
342 watching -
57:40
MattMorseTV
5 hours ago $0.21 earned🔴Trump just SHATTERED the RECORD.🔴
39.1K77 -
43:39
WickedVirtue
2 hours agoLate Night Spooky Plays
12K -
2:04:02
Glenn Greenwald
5 hours agoTrump and Rubio Apply Panama Regime Change Playbook to Venezuela; Michael Tracey is Kicked-Out of Epstein Press Conference; RFK Senate Hearing | SYSTEM UPDATE #508
91.9K100 -
58:36
Total Horse Channel
7 hours ago2025 CSI3* A Coruña Porsche - Grand Prix
18.5K -
2:10:32
megimu32
3 hours agoOTS: Mighty Morphin Power Rangers & the 90s Movie That Defined a Generation
18.4K4 -
1:14:53
Badlands Media
18 hours agoThe SITREP Ep. 128
35.5K7 -
2:44:56
BubbaSZN
3 hours ago🔴 LIVE - FORTNITE WITH NEW KEYBOARD
12.6K1 -
2:17:29
Mally_Mouse
4 hours agoThrowback Thursday! Let's Play: Cuphead
18.8K1 -
LIVE
StevieTLIVE
4 hours agoWarzone HYPE Duos with GloryJean
39 watching