INTRODUCTION TO COMPUTER PROGRAMMING

INTRODUCTION TO COMPUTER PROGRAMMING

Alessio Martino

Instructional goals

The course is intended to teach basic programming concepts to students with no prior coding experience, developing an attitude towards computational thinking. It will provide the students with an understanding of the role that computation can play in solving problems and with the ability to write small programs that allow them to accomplish useful goals.

Intended learning outcomes

Knowledge and understanding: At the end of the course the students will have a deep knowledge of the fundamental principles of computer science and of modern imperative/object-oriented languages. The course will cover all the basics of programming in Python, as well as general computer programming concepts and techniques. Applying knowledge and understanding: At the end of the course the students will be able to solve simple computational problems and to accomplish coding tasks using the Python programming language. Making judgements: We expect students to be able to critically choose the most appropriate programming abstractions for solving simple computational problems on a rigorous methodological basis. Communication skills: The course will give the students the ability to communicate effectively - in English - their ideas, proposals, and critical reasoning in the field of programming and computational thinking. Learning skills: The course will provide the students with the ability to learn a series of design and programming tools and to apply them to different computational problems. The method of study will make the students able to break down complex problems arising in specific applications into manageable pieces and to apply fundamental programming abstractions in order to design rigorous and documentable solutions.

Course Contents

The course will familiarize the students with computer programming and will cover the following topics: - Von Neumann’s architecture - Introduction to programming languages - Python basics - Variables, data types, expressions - Control structures - Repetition structures - Input / output - Functions and modules - Recursion - Strings - Lists - Dictionaries - Object-oriented programming and classes

Reference Books

All the class material is available on the e-learning platform (slides, lecture notes, and reference to the textbook).

Teaching Methods

Lectures and lab sessions. Students' participation during lectures is strongly encouraged.

Assessment Method

Competences will be assessed via a coding test (50% of the final grade), a multiple-choice test (20% of the final grade) and a group project work (30% of the final grade). There will be intermediate tests, the sum of which will count for the coding test and the multiple-choice test. Students that will not take the intermediate tests during the course are required to take the full exam at the end of the course. The coding test aims at demonstrating whether the students have mastered the fundamental principles of programming in the Python language. Through this activity, knowledge and understanding skills and competencies will be assessed. The multiple-choice test, through which the student will have to show to know theoretical concepts, aims at also assessing the learning skills. The group project work aims at also assessing the critical reasoning of the students and their collaborative skills, as they will have to choose the most suitable solution for carrying out the project.

Thesis assignment criteria

A thesis will be assigned (upon specific request to the instructor) to students who have average grade > 27/30 and who demonstrate a serious and motivated interest in the course topics.

Week 1 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Course overview. Computational thinking. Von Neumann’s architecture. Problems, algorithms, and programs. Programming languages: syntax and semantics, interpreters and compilers, errors and debugging. Introduction to Python. Session 3 on line Interactive Python shell. Programming basics: values, types, expressions. Operator precedence. Type(). Casting. Lab and exercise session.

Week 2 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Variables: assignment instructions, binding, dynamic typing. Introduction to strings, concatenation operators. I/O: use of print() and input(). Session 3 on line Lab and exercise session.

Week 3 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Branching instructions: if, else, elif. Nested if statements. Session 3 on line Lab and exercise session.

Week 4 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Reusing code: functions and modules. Writing and invoking functions. Stack frame, execution in LIFO order (Last In First Out). The return statement. Scope of variables. Session 3 on line Lab and exercise session.

Week 5 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Repetition statements: keywords while, for, break. The range() function. Nested cycles. Session 3 on line Intermediate Test #1

Week 6 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Strings. Length of a string. Indexing. Slicing. Immutability. String iteration. Session 3 on line Lab and exercise session.

Week 7 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Lists: defining a list, changing an element (mutability), list iteration, adding and removing elements, slicing. String-list conversion. List sorting. Aliasing. Cloning. Lists of lists. Session 3 on line Lab and exercise session.

Week 8 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Input and output on text and binary files. Session 3 on line Intermediate Test #2

Week 9 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Dictionaries. Tuples. Sets. Examples of dictionary and tuples manipulation. Session 3 on line Lab and exercise session.

Week 10 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Object-oriented programming: classes. Abstract data types: stack and queue. Stack and queue classes. Attributes and methods. Examples of classes definitions. Session 3 on line Intermediate Test #3

Week 11 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Recursion. Examples of recursive functions. Memory management in Python. Stack frame visualization. Session 3 on line Lab and exercise session.

Week 12 Contenuto sessioni on line e on campus

Sessions 1-2 on campus Course recap and follow up Session 3 on line Intermediate Test #4