Summary - Introduction to Programming for CIW (800873-B-6) (800873-B-6)
54 views 4 purchases
Course
Inleiding Programmeren voor CIW (800873B6)
Institution
Tilburg University (UVT)
This document provides a comprehensive summary of the course “Introduction to Programming for CIW (800873-B-6)”. The summary covers essential concepts and programming skills taught in the course. It includes an overview of programming fundamentals, such as variables, data structures and control...
Week 1
Chapter 1 | Getting started with Variables and Values
Built-in functions
● print() → Outputs its argument to the screen.
● sum() → Sums up the numbers in the list.
● input() → Takes user input and returns it as a string.
Keywords
● Argument → Object you put in a function
● String → A sequence of characters
● Comment → Used to document our code and explain what’s happening
● Variable →
● Value →
● Re-assign a variable → The value of a variable changes
Additional theory - Naming variables
1. Use clear, meaningful, descriptive variable names so that your code will remain
understandable.
2. Use the lowercase_with_underscores style, with lowercase characters and underscores
for separating words
3. Do not use built-in names, such as print or sum (these will turn green in Jupyter
Notebooks)
,Chapter 2 | Basic Data Types (Integers and Floats)
Built-in functions
● type() → To check object types.
Methods
● int() → Converts any number or string into an integer object.
● str() → Returns the string version of the object.
Keywords
● String → For representing text.
● Integer → For representing whole numbers.
Float → For representing numbers with decimals.
● Tuple → For representing immutable combinations of values.
● List → For representing ordered sequences of objects.
● Set → For representing unordered sets of objects.
● Dictionary → To represent mappings between objects
● Booleans → To represent the truth values True or False.
● Casting → Converting one type into another type.
● Coercion → Implicit type conversion. For example when you divide 2 integers with
each other the output is a float.
● Operator precedence → The order in which mathematical operations are performed.
Additional theory - Type affordances
It is possible to use “+” for adding up integers and floats. It is also possible to add strings
together. However, it is not possible to add strings and integers/floats up. Python will then
give an error.
Casting types
Not all conversions are possible. For example, we cannot make an integer of the string
“hello”.
,Mathematical operators
, Chapter 3 | Strings
Built-in functions
● repr() → Gives you the Python-internal representation of an object.
● len() → Lets you compute the length of a sequence. (spaces count as characters
too!)
● dir() → Returns a list of method names (as well as attributes of the object).
● help() → If you want to know what a specific method does.
Methods
● str.lower() → Turns a string into all lowercase characters
● str.upper() → Turns a string into all uppercase characters
Keywords
● Index number → The position of a character in a string. Positive index starts at 0.
Negative index starts at -1 and goes backwards.
● Mutability → Whether an object can change or not.
● Immutable → an object cannot be changed.
● f-strings → New string formatting mechanisms that make string interpolation
simpler.
● Method → A function that is associated with an object.
● Dunder methods → Method names that start and end with double underscores. They
are Python-internal.
Additional theory - Multi-line string
Two ways to span strings across multiple lines:
1. With single or double quotes, where we manually indicate that the rest of the string
continues on the next line with a backslash
→ \n (newline symbol) indicates that we want to start the rest of the text on a new
line in the string, the following \ indicates that we want the string to continue on the
next line of the code. Together ( \n\ ).
2. With three single or double quotes.
→ Another way to span strings across multiple lines is by simply using three single or
double quotes.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller ibdeheer. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $6.43. You're not tied to anything after your purchase.