资源预览内容
第1页 / 共62页
第2页 / 共62页
第3页 / 共62页
第4页 / 共62页
第5页 / 共62页
亲,该文档总共62页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Why Program?Chapter 1Python for Informatics: Exploring Informationwww.pythonlearn.comUnless otherwise noted, the content of this course material is licensed under a Creative Commons Attribution 3.0 License.http:/creativecommons.org/licenses/by/3.0/.Copyright 2010- Charles SeverancePre-Requisite: Please Install Pythonhttp:/www.pythonlearn.com/install.phphttp:/www.pythonlearn.com/install.phpBack to the Introduction.Computers want to be helpful.Computers are built for one purpose - to do things for usBut we need to speak their language to describe what we want doneUsers have it easy - someone already put many different programs (instructions) into the computer and users just pick the ones we want to useWhatNext?WhatNext?WhatNext?WhatNext?WhatNext?WhatNext?WhatNext?Programmers Anticipate NeedsiPhone Applications are a marketiPhone Applications have over 3 Billion downloadsProgrammers have left their jobs to be full-time iPhone developersProgrammers know the ways of the programPickMe!PickMe!PickMe!PickMe!PayMe!PickMe!Users .vs. ProgrammersUsers see computers as a set of tools - word processor, spreadsheet, map, todo list, etc.Programmers learn the computer “ways” and the computer languageProgrammers have some tools that allow them to build new toolsProgrammers sometimes write tools for lots of users and sometimes programmers write little “helpers” for themselves to automate a taskComputerHardware + SoftwareNetworks.From a software creators point of view, we build the software. The end users (stakeholders/actors) are our masters - who we want to please - often they pay us money when they are pleased. But the data, information, and networks are our problem to solve on their behalf. The hardware and software are our friends and allies in this quest.InformationDataUserProgrammerWhy be a programer?To get some task done - we are the user and programmerClean up survey dataTo produce something for others to use - a programming jobFix a performance problem in the Sakai softwareAdd guestbook to a web siteWhat is Code? Software? A Program?A sequence of stored instructions It is a little piece of our intelligence in the computerIt is a little piece of our intelligence we can give to others - we figure something out and then we encode it and then give it to someone else to save them the time and energy of figuring it outA piece of creative art - particularly when we do a good job on user experiencePrograms for Humans.http:/www.youtube.com/watch?v=vlzwuFkn88Uhttp:/www.youtube.com/watch?v=sN62PAKoBfEPrograms for Humans.while music is playing:Left hand out and upRight hand out and upFlip Left handFlip Right handLeft hand to right shoulderRight hand to left shoulderLeft hand to back of headRight ham to back of headLeft hand to right hitRight hand to left hitLeft hand on left bottomRight hand on right bottomWiggleWiggleJumphttp:/www.youtube.com/watch?v=vlzwuFkn88UPrograms for Humans.while music is playing:Left hand out and upRight hand out and upFlip Left handFlip Right handLeft hand to right shoulderRight hand to left shoulderLeft hand to back of headRight ham to back of headLeft hand to right hitRight hand to left hitLeft hand on left bottomRight hand on right bottomWiggleWiggleJumphttp:/www.youtube.com/watch?v=vlzwuFkn88Uhttp:/www.youtube.com/watch?v=sN62PAKoBfEPrograms for Humans.while music is playing:Left hand out and upRight hand out and upFlip Left handFlip Right handLeft hand to right shoulderRight hand to left shoulderLeft hand to back of headRight hand to back of headLeft hand to right hipRight hand to left hipLeft hand on left bottomRight hand on right bottomWiggleWiggleJumphttp:/www.youtube.com/watch?v=vlzwuFkn88Uhttp:/www.youtube.com/watch?v=sN62PAKoBfEthe clown ran after the car and the car ran into the tent and the tent fell down on the clown and the car Programs for Python.Programs for Python.name = raw_input(Enter file:)handle = open(name, r)text = handle.read()words = text.split()counts = dict()for word in words:countsword = counts.get(word,0) + 1bigcount = Nonebigword = Nonefor word,count in counts.items():if bigcount is None or count bigcount:bigword = wordbigcount = countprint bigword, bigcountpython words.py Enter file: words.txtto 16python words.py Enter file: clown.txtthe 7Hardware Architecturehttp:/upload.wikimedia.org/wikipedia/commons/3/3d/RaspberryPi.jpg SoftwareInputand OutputDevicesCentralProcessingUnitMainMemorySecondaryMemoryGenericComputerWhatNext?DefinitionsCentral Processing Unit: Runs the Program - The CPU is always wondering “what to do next”? Not the brains exactly - very dumb but very very fastInput Devices: Keyboard, Mouse, Touch ScreenOutput Devices: Screen, Speakers, Printer, DVD BurnerMain Memory: Fast small temporary storage - lost on reboot - aka RAMSecondary Memory: Slower large permanent storage - lasts u
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号