![Page 1: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/1.jpg)
WELCOMETOCOMPUTERPROGRAMMING
![Page 2: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/2.jpg)
LjubovJaanuska
MScincomputerscience
TeachingAssistantinInforma6cs
Ins6tuteofComputerScience,UniversityofTartu
![Page 3: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/3.jpg)
WHATABOUTYOU?
Name?
Whatareyoustudying?
Whereareyoufrom?
Previousexperience?
![Page 4: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/4.jpg)
Whyshouldwelearnprogramming?
???
![Page 5: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/5.jpg)
Courseoverview
Materials-hIps://courses.cs.ut.ee/
Tests,submissionofexercises,points-
hIps://moodle.ut.ee/
![Page 6: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/6.jpg)
Grading
hIps://courses.cs.ut.ee/2017/nkp/fall/Main/Grading
• Tests• Homework+par6cipa6oninthesessions
• Project(formula6on+solu6on)
• Mid-termtest
• Exam(testonpaper+programmingexercise)
![Page 7: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/7.jpg)
Sessions
• Before:• Video• Test• Homework
• Sessions• Wednesday
• Thursday
![Page 8: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/8.jpg)
SoKware
• Python2orPython3• IDLEorNotepad++• CMD???
![Page 9: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/9.jpg)
QuesMonnaire
hIps://goo.gl/forms/7oI4hpqhQjiOWMru1
![Page 10: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/10.jpg)
Bynow…
• Independentlycovered2chaptersofCharlesSeverance:• 2videoslectures• 1test
![Page 11: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/11.jpg)
PROGRAMMING
• Computerswanttobehelpful
butweneedtospeaktheirlanguage
• Programmersarepeoplewhoknowhowtocommunicatewithcomputers
inaprogramminglanguage.
Theyknowhowtowriteprograms
• Programisasequenceofstoredinstruc6ons(commands)
• Programmersfigureoutthesequenceandencodeit
>WRITEABOOK>ERROR
![Page 12: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/12.jpg)
Python
• Python• AprogramminglanguagedevelopedbyGuidovanRossumin1991
• Awaytocommunicatewithcomputersandencapsulateour
instruc6ons
![Page 13: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/13.jpg)
Advice
Atthebeginning,thelanguageisnew.Itishardlypossibletopickupa
languageoverthenight.
Therewillbelotsofmistakes(e.g.syntaxerror):• PCisnotcruelnormakingjokes
• Itsays:“Idon’tunderstandwhatyouaresaying.Ionlyknowafewwords.PleasespeakinPython.”
• BereadythatPCdon’tcorrectyouasteachersdo.TheycanhardlylistenorunderstandourawkwardShakespearianPython
Keepgoing,wonderingthroughout,ediMng,playing,understanding• ItiseasierforyoutolearnPythonthantomakecomputersunderstandEnglish
![Page 14: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/14.jpg)
WHY PYTHON?
Python:
print"Hello,world!"
Java:
publicclassHelloWorld{
publicsta6cvoidmain(String[]args){
System.out.println("Hello,world!");
}
}
![Page 15: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/15.jpg)
InteracMveorScript• InteracMvePython• Youtypedirectlyonelineata6meandPythonresponds
• Isgoodforexperimentsandprogramsof3-4lines
• PythonScript• Youenterasequenceofstatements(lines)intoafileusingatexteditorand
tellPythontoexecutethestatementsinthefile
• add.pyasthesuffixontheendofthesefilestoindicatetheycontainPython
![Page 16: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/16.jpg)
Chapter2-Expressions• Variables• mnemomicallynamedplaceinthememorywhereaprogrammercanstore
dataandlaterretrievedatausingthevariablename
• MuststartwithaleIerorunderscore_
• MustcontainleIers,numbersorunderscore
• CasesensiMve
• Constants• Numbers,leIers,andstringareconstants
• Theydonotchangetheirvalue• 123 98.6 ‘Hello, world’ “Hello, world”
• type() • Types int float str • Typeconversion int() float() str()
![Page 17: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/17.jpg)
Expressions• Assignmentstatement
• e.g.x = 2 • Hey, Python, go and find a place called ‘x’ and store there 2
• Assignmentwithexpression(e.g.x = x + 2 )
• Operators • Addition + • Substracion - • Multiplication * • Division / Truncateddivision450 / 100resultis4 vs 450.0 / 100 resultis4.5
• Power ** • Remainder or moder % (450 % 100 resultis50)
OrderofevaluaMon(operatorprecedence) () ** */% +-leptoright
![Page 18: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/18.jpg)
Expressions
• Reservedwords(e.g.print, for, elif, while)• Userinputraw_input(‘Hello’) • Comments #
![Page 19: WELCOME TO COMPUTER PROGRAMMING€¦ · WELCOME TO COMPUTER PROGRAMMING Ljubov Jaanuska MSc in computer science ... • PC is not cruel nor making jokes • It says: ... • 123 98.6](https://reader030.vdocument.in/reader030/viewer/2022040616/5f1329b48eeb1316ad2af935/html5/thumbnails/19.jpg)
Test1
Ques6ons?