Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Samenvatting

Information & Data Management: SUMMARY Automate The Boring Stuff with Python

Beoordeling
-
Verkocht
10
Pagina's
24
Geüpload op
01-09-2019
Geschreven in
2018/2019

English summary for the course Information & Data Management of the bachelor Business Administration at the UvA. It includes all the required chapters of 'How to automate the boring stuff with Python' and some additional lecture notes. If you read this you will understand Python and programming way better! :) Following the course outline, this summary includes: Chapters 1 and 2, 3, 4 , 5, 6, 8. Information & Data Management: SUMMARY of the book: Automate The Boring Stuff with Python, ISBN: 9 7815 9327 5990

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

AUTOMATE THE BORING STUFF:
/ CH1 /

A window with the >>> prompt should appear; that’s the interactive shell.

2 + 2 is called an expression: consist of values (such as 2) and operators (such as +),
and they can always evaluate (that is, reduce) down to a single value.

** Exponent 2 ** 3 8

% Modulus/remainder 22 % 8 6

// Integer division/floored quotient 22 // 8 2

Modules/Remainder: divides by whole number (22-(2x8)=6)
Integer division: divides by whole number and deletes any decimals. 22//8=2.75 → = 2

Precedence: the order of operations: ** , *, /, //, % , +, - . Use parentheses ( ) [haakjes] to
override the usual precedence if you need to.

Data type: a category for values, and every value belongs to exactly one data type.
- Integer (int): indicates values that are whole numbers.
- Floating-point (floats): Numbers with a decimal point, such as 3.14. Note that
even though the value 42 is an integer, the value 42.0 would be a floating-point
number.

- Strings: single quote showing where to begin and end.
'a', 'aa', 'aaa', 'Hello!', '11 cats' '' = blank string

When + is used on two string values, it joins the strings as the string
concatenation operator.
>>> 'Alice' + 'Bob'
'AliceBob'
Combining an + operator on a string and an integer value will result in an error.

Combining an * operator on a string value and one integer value = string
replication operator
>> 'Alice' * 5
'AliceAliceAliceAliceAlice'
‘Alice’ * 5.0 would give an error.

Variable: a box in the computer’s memory where you can store a single value (to use later).
1. Only one word.
2. Use only letters, numbers, and the underscore _ character.
3. Can’t begin with a number.
a) Variable names are (capital letter) case-sensitive.

Assignment statement: consists of a variable name, an equal sign (= assignment
operator), and the value (=integer value) to be stored.
>>> spam = 40
>>> eggs = 2
>>> spam + eggs
42

,A variable is initialized the first time a value is stored in it.
Overwriting the variable: When a variable is assigned a new value, the old value is forgotten.
>>> spam = spam + 2
>>> spam
42

File editor: has some specific features for typing in source code.
- The interactive shell window will always be the one with the >>> prompt.
- The file editor window will not have the >>> prompt.

When there are no more lines of code to execute, the Python program terminates (exits);
that is, it stops running.

# is a comment. Python ignores comments (and the blank lines after it), and you can use
them to write notes or remind yourself what the code is trying to do.
Commenting out: Sometimes, programmers will put a # in front of a line of code to temporarily remove it
while testing a program.


The print() function displays the string value inside the parentheses on the screen.
When Python executes a line, you say that Python is calling the print()function and
the string value is being passed to the function. A value that is passed to a function
call is an argument.

The input()function waits for the user to type some text on the keyboard and
press ENTER. Always returns a string (even if the user typed in a number).

print('It is good to meet you, ' + myName)

The len () function: evaluates to the integer value of the number of characters in that
string.
>>> len('hello')
5

The str() function is handy when you have an integer or float that you want to concatenate to a
string.
>>> str(29)
'29'
>>> print('I am ' + str(29) + ' years old.')
I am 29 years old.


The int() function is helpful if you have a number as a string value that you want to
use in some mathematics. Treat variable as an integer instead of a string:
>>> spam = input()
101

>>> spam = int(spam)

>>> spam *
202.0


The int () function is useful if you need to round a floating-point number down. If you
want to round a floating-point number up, just add 1 to it afterward.

2

, >>> int(7.7)
7
>>> int(7.7) + 1
8

An integer can be equal to a floating point, as they’re both numbers (unlike a string, which is
text).
>>> 42 == 42.0
True
>>> 42.0 == 0042.000
True




/ CH2 /

Flow control statements can decide which Python instructions to execute under which
conditions. There is usually more than one way to go from the start to the end.

Boolean data type has only two values: True and False.
>>> spam = True
>>> spam
True


Comparison operators compare two values and evaluate down to a single Boolean value.
Operator Meaning
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to

>>> 'dog' != 'cat'
True
>>> 42 == 42.0
True
>>> 42 == '42'
False

>>> eggCount = 42
>>> eggCount <= 42
True

• The == operator (equal to) asks whether two values are the same as each other.
• The = operator (assignment) puts the value on the right into the variable on the
left.




3

Gekoppeld boek

Geschreven voor

Instelling
Studie
Vak

Documentinformatie

Heel boek samengevat?
Onbekend
Geüpload op
1 september 2019
Aantal pagina's
24
Geschreven in
2018/2019
Type
SAMENVATTING

Onderwerpen

$8.39
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
chiara-uva Universiteit van Amsterdam
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
570
Lid sinds
8 jaar
Aantal volgers
359
Documenten
0
Laatst verkocht
2 maanden geleden

4.2

72 beoordelingen

5
28
4
35
3
7
2
1
1
1

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen