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

Practical Class #02 - First Programs (30/09 to 04/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: October 19th (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 the VSCode IDE and the Python interpreter for your first Python programs
  2. Manipulate simple data and algebraic expressions
  3. Handle Input and Output
  4. Debug simple programs

If you feel stuck, go back and revise the lecture T02: The basics


1) My first Mooshak submissions


On this course we will use Mooshak to automatically evaluate your Python code (see Mooshak's help).

In this problem the goal is to make your first submissions in Mooshak, all for the [IP001] Hello there. The problem statement will also be available inside Mooshak. Always start by carefully reading the problem statement given!

  1. Start by submitting an Accepted in Mooshak. Create a file called for instance ip001.py, write the code and test it in your computer. Is it doing what you expected?
  2. After a correct submission you should now experiment with some common errors to see the behavior of Mooshak in these cases:

2) Reading my first input


For this exercise you will be solving the problem [IP002] Bond, James Bond!.

  1. Read the problem, code and submit an Accepted solution. Don't forget to test first on your computer!
  2. After a correct submission experiment with another type of error, by adding one more instruction to read something from the output (e.g. read three lines of input).
    Submit to Mooshak to see what happens and to discover your first Runtime Error.
    If you click on the underlined result itself you can see a detailed table containing the result of each test case and also giving you the first input where your program failed, and the respective expected output (should be something like this picture - note on how the observations report what error was obtained).

Here are a couple more notes about Mooshak on this course:


3) Training with Mooshak


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

  1. [IP003] Check Please
  2. [IP004] Circle Math
  3. [IP005] E-I-E-I-No
  4. [IP006] Time Goes By

Extra exercise for consolidating your knowledge [extra]

IP Mooshak classes will usually include at least one extra exercise that you can use of you want to keep testing your knowledge of the material. For this class we propose another problem for you will only need what you learned in lecture #02 - The Basics.


Challenge exercise [challenge]

IP Mooshak classes will usually include one challenge exercise, which can be much harder the previous ones and might even need knowledge that was not given explicitly on the course.

However, since this is the first challenge, it is almost of the same difficulty of the previous exercises.

Happy coding! 😊 (if you finish everything and need more practice exercises, let us know on discord - we have plenty more to give you 💻)