Before we answer this question let’s create a simple
program in Python ran from command prompt.
>>>print “Hello world!” Hello world!
Program
is a list or sequence of statements that have been crafted to do some work.
Even this one line of code is a program.
It is a one-line program and is not particularly useful but in the strictest
definitions it is a Python program.
Imagine
that you’re searching in .txt folder specific set of words or numbers that you
want to use later for data analysis or to perform some calculation. The .txt
file has thousands of lines that would require enormous amount of time to
extract this data from file. So if you know programming language and apply a
search algorithm that will scan whole document find data and make further data
processing than you saved a lot of time.
input
|
Get data from the “outside world”. This might be
reading data from a file, or even some kind of sensor like a microphone or
GPS. In our initial programs, our input will come from the user typing data
on the keyboard.
|
output
|
Display the results of the program on a screen or
store them in a file or perhaps write them to a device like a speaker to play
music or speak text.
|
Sequential execution
|
Perform statements one after another in the order
they are encountered in the script.
|
conditional execution
|
Check for certain conditions and execute or skip a
sequence of statements.
|
repeated execution
|
Perform some set of statements repeatedly, usually
with some variation.
|
reuse
|
Write a set of instructions once and give them a
name and then reuse those instructions as needed throughout your program.
|
Nema komentara:
Objavi komentar