6.2 - Cython
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What does Cython do?
💡 Hint: Think about optimizing Python code.
How do you declare a function in Cython?
💡 Hint: Remember the keyword for dual access.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What is the main purpose of Cython?
💡 Hint: Focus on what Cython does to Python code.
Cython allows using which keyword to define functions?
💡 Hint: What keyword indicates dual access to functions?
1 more question available
Challenge Problems
Push your limits with advanced challenges
Write a Cython function that calculates the factorial of a number, using type declarations for the parameter and return value. Compile it and explain how you would do that.
💡 Hint: Consider both the logic of factorial and Cython syntax.
Create a Cython program that uses a loop to sum integers from 1 to N, where N is an int type. Measure the improvement in speed compared to pure Python.
💡 Hint: Utilize the timeit module for measuring performance.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.