0% found this document useful (0 votes)
15 views1 page

Drawboard

Uploaded by

Chenthil Kumar K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Drawboard

Uploaded by

Chenthil Kumar K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

CHAPTER 4 ■ PROGRAMMING BASICS FOR SECURITY ENTHUSIASTS AND HACKERS

64
Once it is installed, there are various ways of interacting with Python:
Using the Python IDLE GUI, you can directly interact with Python. In Figure 4-2 , we
entered 2+2 and Python returned us the result 4. Then we passed the command
print "Hello World" and Python printed “Hello World” as output on the screen.
1. In addition to direct interaction with the Python Shell, you can also use your
favorite text editor to write a Python script and then execute it. Notepad++ is a
very good text editor which allows for proper indentation and syntax checks. It
is available at https://notepad-plus-plus.org . Save the Python program with
the .py extension in order to make it executable.
Printing and Reading Input
Accepting input from the user and displaying the results back to the user are among the most
common
activities in any programming language. In Python it’s very easy to do these tasks.
To accept input from the user we use the function raw_input() , and to display the result back to
the
user we use the function print() .
name = raw_input("What is your name?")
print ("Hello '+name+', welcome to Python Class")
C:\Users\apress>read_input.py
What is your name? John
Hello John, welcome to Python Class
So far we have seen how to accept input from the user and store it in a variable. However, there
might
be a situation where it is required to store multiple elements of different data types. In such a case
we need a
special data type: the list, described in the next section.

You might also like