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
College aantekeningen

UOA COMPSCI 101 BEST FULL NOTES | A+ | Cert. of Outstanding Achievement!

Beoordeling
-
Verkocht
-
Pagina's
37
Geüpload op
30-01-2023
Geschreven in
2022/2023

================CHEAPEST NOTES!!!================ ===============MINIMUM SALE PRICE=============== ************************ ONLY $5.49************************** My Grade Using These Notes: I got an A+ for COMPSCI 101 using these notes. I was among the top 10 achievers in a class of no less than 500 students! I also got a Certificate of Outstanding Achievement for my performance; with these notes, you can do the same, if not better! Hey there,If you want to excel in computer science, you've come to the right place!The notes you are about to see cover the entire 12-week COMPSCI 101 course at the University of Auckland. The notes are sorted by week and lecture and have headings to sort topics out neatly! Every single lecture is covered in-depth with these notes - A total of 37 pages! The notes are loaded with examples, photos, diagrams, algorithms and summaries to help you succeed. These notes will arm you with the information to fly through your exam and easily get an A+ in all coursework, just as I did! Specifications: File Type: PDF File Size: 924 KB File Resolution: HD Pages: 37 Succeed, Impress Family and Friends, Show your future employers your outstanding achievements and most of all, Have fun! Good luck with your studies and future career!

Meer zien Lees minder

Voorbeeld van de inhoud

COMPSCI 101, Week 1, Lecture 2

When given a problem, we convert it into an algorithm. Break down problem into sequence of steps.

Algorithm is a finite set of steps that specifies a sequence of operations to be carried out in order to solve a specific
problem.

A computer program is an algorithm defined in a programming language.

Program is a sequence of instructions that performs a task.

Natural Langs. English, spoken by humans

Formal Langs. Math Notations, chemical structures, programming languages.

Programs are deterministic, results well defined, predictable



Programming languages

Machines only execute low-level languages, high-level languages (python) need to be processed to be executed
which takes some time, disadvantage for high-level langs.

Easier to program high-level, less time to write, shorter, easier to read, more likely to be correct, easy to maintain.
High-level langs. Are portable. Portable: Run on different kinds of computers with few, no modifications. Low-level
only can run on one type of computer, must be rewritten for other. Most programs written in high-level, low-level
only for specialised applications.

Two types of programs to process high-level langs. Interpreter and Compiler.

Interpreter reads program, executes. It does what program says. It processes it little at a time, alternate line read
and computations.




Compiler reads program, translates completely, then executes. High-level program (source code) gets complied into
object code/executable (low level). Then it can be executed repeatedly without further translation.




Python Interpreter

Source Code (Programs) are written in a programming language

Python interpreter translates and executes source code, into machine-code called Bytecode

, Variables

Any name works with some restrictions (not function name, no number first, no operator, no spaces)

Store only one variable at a time

Can be assigned to values. (=)

Cannot be any keyword

and elif import raise as else in return assert except is try break finally lambda

while class for nonlocal with continue from not yield def global or del if pass



Python is case sensitive, use lowercase for variables

Pythons style guide, conventions etc



Four basic types of info

Integer

Floating point

String

Boolean

Integer can be + 0 or -, no decimal

Floating point numbers have decimal point. Can be + 0 –

Left handside is always a variable, right hand side is value, expression

The right hand side of an assignment operator (=) is always computed first and then is assigned to the

Left hand side



Math operators

Add +

Subtract –

Multiply *

Divide /

Exponentiation/power of **

Precedence of Operators is

()

**

*, /, //, %

,+, -

For operators with same precedence, calculations are done left to right.

Division operations (/) results are always given as floating points e.g. 3/2 = 1.5, 6/2 = 3.0

An expression/variable can be used anywhere a single value can be used

String

String is a collection of characters delimited by ‘ or “

Print function

Print() uses brackets

When print prints the values in the brackets a line break is added.

So any further printing will be shown on the next line.

If no argument is given with print e.g. print(), This prints a blank line

Can be used to print more than one value/variable on a single line

Each value to be printed is separated by a comma.

e.g. print(1,’Hello’,’World’) 1 Hello World

print(‘The final results are:’,56,’and’,44) The final results are: 56 and 44

The default separator between different values to be printed is a single space.

Print(‘Final amount is $’, 100) Final amount is $ 100 (unnecessary space)

To change the default separator we provide an optional last argument to the print function

sep=’[your choice of separator]’ with double or single quotes

Eg

Print(‘Hello’, ‘World’, sep=’*’ Hello*World

So we can fix $ 100 so

Print(‘Final amount is $’, 100,sep=””) Final amount is $100,



end

, COMSCI 101, Week 1, Lecture 3

Literals

Literals are values that can be stored in program memory

Eg.

20, string

Year=2022

Year is variable and 2022 is literal

Variables can be assigned to and literal value or an expression. Variables refer to a single piece of info

Expressions

Made up of literal values and variables, expressions always evauluate to a single value. Right hand side of (=) is
expression.

Docstrings

Special string used to provide documentation.

3 consecutive quotes are used to surround docstring. In the format:

“””

Docstring

“””

Interpreter ignores docstring

Docstring gives author info and program description.

Program must have docstring

Too much info should not be provided, only general info

EVERY PROGRAMMING ASSIGNMENT MUST HAVE DOCSTRING, UNLESS TOLD OTHERWISE

Notes

After # to the end of the line is considered a note/comment, will not be read by interpreter

Only add when necessary, when code is difficult to comprehend.

Better than comments is to use descriptive variable names like this:

Documentinformatie

Geüpload op
30 januari 2023
Aantal pagina's
37
Geschreven in
2022/2023
Type
College aantekeningen
Docent(en)
Mohammad ghafari; angela chang
Bevat
Alle colleges

Onderwerpen

$5.99
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
mightymihir100

Maak kennis met de verkoper

Seller avatar
mightymihir100 The University of Auckland
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
3 jaar
Aantal volgers
0
Documenten
1
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

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