Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien 4.2 TrustPilot
logo-home
Resume

Beknopte wet. programmeren samenvatting (PYTHON)

Note
-
Vendu
-
Pages
14
Publié le
25-09-2024
Écrit en
2023/2024

Dit document bevat een samenvatting van het vak wetenschappelijk programmeren in de programmeertaal Python. Het bevat formules, redeneringen, voorbeelden, ... . De inhoud staat vermeld per PC lab.










Oups ! Impossible de charger votre document. Réessayez ou contactez le support.

Infos sur le Document

Publié le
25 septembre 2024
Nombre de pages
14
Écrit en
2023/2024
Type
Resume

Aperçu du contenu

Wetenschappelijk programmeren: pyhton
PC lab 1
7 ---> int
➔ ASCII
7.8 ---> float
“sqldngoi” ---> str -> built in gegevenstype
B = True (=1) / Falsee (=0) ---> bool
List = [ B, “a”, 8, -16.13 ]

Operatoren: (vanaf 1 float => resultaat ook float)

- Op int en float:
o +;-;*; /
o ** ---> machtsverheffing
o // ---> gehele deling
o % ---> rest na deling
- Op str: a = ‘mooi’ ; b = ‘weer’
o a + b ---> concatenatie ~~~> ‘mooiweer’
o a*3 ---> duplicatie ~~~> ‘mooimooimooi’
- op bool:
o and, not x, or
o <, <=, >, >=, !=, ==
- Logische operatoren: &, |, ^, ~

Ingebouwde functies:

- Len() --> # karakters
- Pow(x, 2) ---> x tot de tweede macht
- Round(3.14159, 2) ---> afronden 2 getallen na komma
- Max(x,y,z) // Min(x,y,z) ---> max // min v argumenten
- Abs(-6298) ---> absolute waarde
- Range(6,36,2) ---> van 6 tem 35 in stappen v 2 (start, stop, step)
- Help() ---> functiedocumentatie weergeven
- Print()
o Sep = “-“*10
o End = “!” ; end = “\n” ---> nieuwe regel
- Andere: tabel 3.4 (p62 op computer)

Aliasing:

- a=2 ; a=b => b = 2 (garbage collection)

Expressie  statement met a = 8

- Expr: 8 + 3*4 log expr: a > 2
- Stat: res1 = a + 3*a -2 res2 = a < 2 (---> False)

Modules:

- Import math: (3.6.2)
o Math.sqrt()

, o Math.sin()
o …
- Import random (3.6.3)
o Random.randit(1,6) ---> random getallen tss 1 en 6
- Import numpy
o numpy.mean([2,4,9]) = gem v 2,4,9 = 15/3 = 5
o Eenv: import numpy spec: from numpy import mean met alias: import
numy as np

Typeconversies:

- Type() ---> gegevenstype opvragen: int / float / str / bool
- Bij input: gegstype = str
- Float -> str // int -> float // int -> str
- Float -> int ~~~> afronden naar 0
- Str -> float/int ~~~> niet altijd mogelijk



PC lab 2
If-elif-else:

- If LE1:
Uit te voeren code ----> als LE1 = True (stopt hier: gaat niet verder nr elif,
programma stopt wnr 1e criterium voldaan is => met negatieve werken)
- Elif LE2:
Uit te voeren als LE1 = False en LE2 = True
- …
- Else:
Uit te voeren als alles hierboven = False
- Kan genest w

While(-else):

- While LE:
Code die herhaaldelijk uitgevoerd w zolang LE = True
Else:
Code die 1x uitgevoerd w als False bij while
(als 1 keer totaal printen: uit while-lus ; als iedere keer printen: in while-lus)
(vaak in while lus opnieuw vraag stellen zodat lus blijft doorgaan)
- Som v getallen: getal = (2)
som = 0 (teller initialiseren vóót wihile-lus)
while ???: (waaraan het moet voldoen)
som = som + getal
getal = getal + (stappen waarin je gaat)
- Alles in lus moet aan de VOORWAARDE voldoen
- Als nooit = False => oneindige lus (stoppen: scripts -> CNTRL-SHIFT-C ; interactive:
interrupt/restart)
- Kan genest w
- Stopt als ‘exact’/’break’ ingegeven w
€4,46
Accéder à l'intégralité du document:

Garantie de satisfaction à 100%
Disponible immédiatement après paiement
En ligne et en PDF
Tu n'es attaché à rien

Faites connaissance avec le vendeur
Seller avatar
biobroeder

Faites connaissance avec le vendeur

Seller avatar
biobroeder Universiteit Gent
Voir profil
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
0
Membre depuis
1 année
Nombre de followers
0
Documents
6
Dernière vente
-

0,0

0 revues

5
0
4
0
3
0
2
0
1
0

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions