Professional Documents
Culture Documents
Programming
Programming
Programming
Unit - I
1. What Is Programming?
Programming writing code through an iterative process of
program.
Your First Program: Hello, World
Code, shown in Figure 1.2.3, I’m going to write a simple
command:
print(“Hello, world”).
This is a simple command that instructs the computer to
print the text “Hello, world.” When I run this little one-line
program, the console on the right prints the string of text I
asked it to print.
3. Writing Code: Lines in Python
Your First Program: Hello, World
print(message)
if not handled.
5. Executing Code in Python
Encountering Errors
Let’s try an example of this. In Figure 1.2.6 are five lines
of code. You might notice that the fifth line has an error:
I’ve misspelled the word “print.”
What happens when I run this code? The first four lines
run just fine and print their output, but when the computer
reaches line 5, it prints the error message shown on the
right, under ‘Traceback’. This error message then gives us
the information we need to track down and repair the
problem we encountered.
5. Executing Code in Python
“Compiling” Python
Although Python is a dynamic language that does not
going on.
6. Evaluating Results
Errors in Python
6. Evaluating Results
Errors in Python
The code shown in Figure 1.2.9 is intended to print the