100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Samenvatting Computationeel Denken Final Exam(INFOCODE)

Rating
-
Sold
2
Pages
21
Uploaded on
27-05-2021
Written in
2019/2020

Stof voor eindtentamen van CODE.

Institution
Course










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
May 27, 2021
Number of pages
21
Written in
2019/2020
Type
Summary

Subjects

Content preview

SV CODE eindtentamen
Isabelle van Aard – januari 2020

College 10 – Bestanden en exceptions

Bestanden lezen en schrijven

• Wiskundige taken (Bereken de kans dat je een aantal keer achter elkaar zes gooit)
• Geen externe input
• Meeste taken gebruiken data
• Input van de gebruiker, command line argument, webservice, database
• Data in bestanden
• Data science, information retrieval: heel vaak tekstbestanden
• Verschillende manieren om bestand te lezen
• Hele bestand: tekst = bestand.read()
• Een regel: regel = bestand.readline()
• Alle regels in een lijst: alle_regels =
bestand.readlines()
• Gebruik in for-loop bestand =
open("inhoud.txt")
for regel in bestand:
print(regel)
• Bepaald aantal karakters: stuk = bestand.read(10)
• Een bestand is een lange rij bytes. Elke byte representeert een karakter
• Regeleindes zijn een speciaal karakter \n
o Bij het ontwaken\neen handvol confetti\nop het hoofdkussen
o → Teksteditors ‘vertalen’ het teken \n naar een visueel
regeleinde
• Python-functies lezen bytes totdat ze \n tegenkomen
o readline(), readlines(), for regel in bestand
• Dit karakter wordt ook gelezen en opgeslagen in de variabele
• bestand = open("gedicht.txt")
regel = bestand.readline() # regel is nu "Bij het
ontwaken\n"
• print() interpreteert \n ook als regeleinde
• print() voegt zelf ook altijd een regeleinde toe
• Dus: twee regeleindes → lege regel
• Bestand sluiten na gebruik
• Opnieuw lezen, lezen na schrijven, overschrijven
• In Python: bestand.close()
• Automatisch sluiten: blok met with en as
bestand = open("inhoud.txt")
for regel in bestand:
print(regel.strip())
bestand.close()
• with open("inhoud.txt") as bestand:
• for regel in bestand:
o print(regel.strip()) # bestand automatisch gesloten

1

, • open("bestand.txt", "w") → haalt bestaande inhoud weg
• Vaak de bedoeling
• Voorbeeld: preprocessing van tekst opslaan in bestand
• Andere gevallen: na bestaande tekst doorgaan
• Voorbeeld: log-bestanden, resultaten experimenten
• Append met open("bestand.txt", "a")
• Expliciet lezen: open("bestand.txt", "r")
o "r" is default-waarde van dit argument

CSV




• CSV-bestanden schrijven
• Strings niet verplicht
• import csv csv_file =
open("cijfers.csv", "a")
• cijfer_uit = csv.writer(csv_file)
cijfer_uit.writerow(["John Smith",7,5,9,7])
cijfer_uit.writerow(["Jane Doe",8,4,7,6.3])
csv_file.close()




2

, Exceptions




College 11a – Music information retrieval

➢ MIR is concerned with the extraction, analysis, and usage of information about any kind of
music entity (e.g., a song or a music artist) on any representation level (bv audio signal,
symbolic MIDI representation of a piece of music, or name of a music artist)
o MIR is hardly a stable concept, but a very lively research area

MIR scenarios:
• Melody search → puur IR (zoekvraag en ik wil iets vinden); de rest gaat meer over actieve
betrokkenheid in de muziek.
• Query by humming (zingt liedje in hoofd en systeem herkent wat je doet)
• What's playing? (Shazam: opname identificeren)
• Recommendation (discover weekly: nieuwe muziek)
• Music I can play along with (chordiffy; yt movie met leuke muziek --> track uploaden en
dan kan je meespelen (want je ziet de song op je beeld en dan kan je het volgen op je gitaar oid)


3
R141,92
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Document also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
IsabelleU Universiteit Utrecht
Follow You need to be logged in order to follow users or courses
Sold
133
Member since
4 year
Number of followers
86
Documents
34
Last sold
1 month ago

3,8

4 reviews

5
2
4
0
3
1
2
1
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions