Introduction to Programming 2024/2025 (CC1024) - DCC/FCUP

Practical Class #04 - Functions (14/10 to 18/10)


Exercises for submission

In what concerns the "exercises during classes" component of the evaluation, the exercises that you can submit for this class are:

Deadline for submission: November 2nd (submit to IP's Mooshak)

You are encouraged to talk to the professors and your colleagues if you encounter difficulties. However, any more direct help that you receive should be acknowledged in the comments of the code you submit.
After the deadline the problems will still be available on Mooshak, but the submissions will not count towards your grade.
Each practical class is worth 10% of your final component for exercices during class. Since there will be 11 classes with submissions, you can achieve maximum grade even without doing all classes.
For a problem to count you must pass all tests (that is, to have an accepted). Even if you solve all problems, the maximum on one class is 100%.
To obtain 100% it will always be enough to solve the main exercises.


With the exercises in this class you will develop the following skills:

  1. Explore function definition and function calling
  2. Explore argument passing and return statements
  3. Practice breaking down problems into smaller tasks by writing functions
  4. Explore how functions help in reusing code and making it more organized

If you feel stuck, go back and revise the lectures T02: The basics | T03: Conditionals | T04: Program Flow | | T05: Functions | T06: More Functions


1) Mooshak Submissions (main exercises)


Read the statements, code and try to submit Accepted solutions to all of the following problems. Don't forget to test first on your computer!

  1. [IP025] Summing Numbers
  2. [IP026] Freezing in here
  3. [IP027] All in one
  4. [IP028] And may the odds...
  5. [IP029] Pythongoras
  6. [IP030] Factorial Frenzy
  7. [IP031] Combinatorial Calculations

We encourage you to speak with your colleagues and with your professors if you need help (including using Discord), but be aware that you should be trying to solve the exercises by yourself!

The more effort you put into this course, the more you'll gain from it. By diving into the exercises and tackling the challenges yourself, you'll not only strengthen your understanding but also learn valuable lessons from your mistakes!

Those moments of struggle often lead to the most memorable breakthroughs! Take the challenge head-on, and enjoy the journey! 😊



2) Extra exercises for consolidating your knowledge [extra]

Loved the main exercises and craving more challenges? These extra problems are here to help you sharpen your skills and reward those that are coding for the love of learning 😄


Read the statements, code and try to submit Accepted solutions to all of the following problems. Don't forget to test first on your computer!

  1. [IP032] Come Closer
  2. [IP033] Numerus Maximus!
  3. [IP034] Collatz Sequence

3) Challenge exercises [challenge]

You’ve made it this far, and now it's time for the final challenge! Push yourself, you've got this!


Read the statements, code and try to submit Accepted solutions to all of the following problem. Don't forget to test first on your computer!

  1. [IP035] Just an Average Party

Happy coding! 😊