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.
-
1:01:40
HotZone
6 days ago $11.36 earned"Prepare for WAR" - Confronting the URGENT Threat to America
78.2K18 -
20:23
Scammer Payback
13 hours agoTerrifying Scammers with File Deletions
45.6K13 -
16:22
The Gun Collective
9 hours agoWOW! 17 New Guns JUST GOT RELEASED!
59K11 -
1:13:57
Glenn Greenwald
10 hours agoYoung Men and Online Radicalization: Dissecting Internet Subcultures with Lee Fang, Katherine Dee, and Evan Barker | SYSTEM UPDATE #516
189K76 -
1:14:57
Sarah Westall
7 hours agoCEO of Crowds on Demand: The Fake World of Social Media, Protests & Movements w/ Adam Swart
72.3K11 -
4:03:25
Geeks + Gamers
10 hours agoTuesday Night's Main Event
83.5K2 -
40:36
RiftTV
9 hours agoHow We Got 400 Leftists FIRED for MOCKING Charlie Kirk | The Rift | Guest: Olivia Krolczyk
81.7K65 -
1:28:58
Badlands Media
23 hours agoBadlands Story Hour Ep 134: Godzilla Minus One
49.9K8 -
1:33:43
Patriots With Grit
18 hours agoWrongful Death Without Consequences: Inside the Schara Trial | Scott Schara
26.6K1 -
13:09:25
LFA TV
21 hours agoLFA TV ALL DAY STREAM - TUESDAY 9/16/25
246K49