Python An Introduction
()
About this ebook
Python an Introduction.
Start learning Python and answer some questions to guage your knowledge on Python.
Related to Python An Introduction
Related ebooks
Programming with Python Rating: 0 out of 5 stars0 ratingsTouchpad Prime Ver. 1.2 Class 7: Windows 7 & MS Office 2010 Rating: 0 out of 5 stars0 ratingsLearn Python Programming the Easy and Fun Way Rating: 1 out of 5 stars1/5Ethical Hacking: A Beginners Guide To Learning The World Of Ethical Hacking Rating: 3 out of 5 stars3/5Python. Easy Steps to Learning. Rating: 0 out of 5 stars0 ratingsPython from the Very Beginning Rating: 0 out of 5 stars0 ratingsTouchCode Class 7: Coding Book Rating: 0 out of 5 stars0 ratingsPython for Beginners Rating: 0 out of 5 stars0 ratingsPython Handbook For Beginners. A Hands-On Crash Course For Kids, Newbies and Everybody Else Rating: 0 out of 5 stars0 ratingsAbsolute Beginner's Python Programming: The Illustrated Guide to Learning Computer Programming Rating: 1 out of 5 stars1/5Touchpad Prime Ver. 1.2 Class 8: Windows 7 & MS Office 2010 Rating: 0 out of 5 stars0 ratingsPython Power: For Absolute Beginners Rating: 0 out of 5 stars0 ratingsPython Programming: Your Step By Step Guide To Easily Learn Python in 7 Days Rating: 3 out of 5 stars3/5Python programming for beginners: Python programming for beginners by Tanjimul Islam Tareq Rating: 0 out of 5 stars0 ratingsBeginners' Artificial Intelligence and Python Programming Rating: 0 out of 5 stars0 ratingsPython for Beginners: A Crash Course to Learn Python Programming in 1 Week Rating: 0 out of 5 stars0 ratingsPython for Beginners: An Introduction to Learn Python Programming with Tutorials and Hands-On Examples Rating: 4 out of 5 stars4/5Python for Absolute Beginners: Learn to Code Fast! Rating: 0 out of 5 stars0 ratingsPythonic AI: A beginner's guide to building AI applications in Python (English Edition) Rating: 5 out of 5 stars5/5PYTHON FOR ACCOUNTING & BUSINESS: Volume 1 Rating: 0 out of 5 stars0 ratingsMission Python Rating: 0 out of 5 stars0 ratingsProgramming Concepts in Python Rating: 0 out of 5 stars0 ratingsPYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Introduction to Python 2018 Edition Rating: 4 out of 5 stars4/5Python Bees Rating: 0 out of 5 stars0 ratingsPython Programming Concepts Rating: 0 out of 5 stars0 ratingsTiny Python Projects: Learn coding and testing with puzzles and games Rating: 4 out of 5 stars4/5Master Python Without Prior Experience Rating: 0 out of 5 stars0 ratings
Programming For You
SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5PYTHON PROGRAMMING Rating: 4 out of 5 stars4/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Python 3 Object Oriented Programming Rating: 4 out of 5 stars4/5Python for Data Science For Dummies Rating: 0 out of 5 stars0 ratingsExcel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsCoding All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsPYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Microsoft Azure For Dummies Rating: 0 out of 5 stars0 ratings
Reviews for Python An Introduction
0 ratings0 reviews
Book preview
Python An Introduction - Renier Engelbrecht
Chapter 1 - Introduction ¶
Python is simple language to understand as most of the commands are plain English. In this chapter, you are going to use Python to create simple scripts, in the interactive interpreter. An interpreted language is where the interpreter runs command for command, as opposed to a compiler language that takes all the code, compiles to byte code/executable and then runs the program. Therefore Python can have an interactive compiler, as Python is an interpreted language. The user enters a command in the interactive interpreter, and the command is executed. In this series the focus is on Python 3.4. There are two major versions of Python. The first is 2.7 and then there is 3.4. The difference is that 3.4 is the newest version that is to a major extend incompatible with code from 2.7. To maintain continuity and let developers make a transition to version 3, the older version is still supported. To use the newest version is better, as this contains all the new syntax and other enhancements.
IDLE IDEThe interactive Python Shell, as the screenshot above is called, is mainly used for short interactive sessions where the user want to write short amount of code, to test, debug(clear errors), or write specific procedures. In this chapter we focus on this interactive session. As soon as the Python IDLE Shell is closed, all data entered will be erased! Start Python IDLE. The shortest program that one can write is where the interpreter greets a person. For example; Hi there Sally! To do this, the user writes this in a print statement.
Output ¶
In [3]:
print ('Hi there Sally!') print (Hi there Sally!
)
Hi there Sally!
Hi there Sally!
The user entered a print statement. Take note of the following: all lower case the word print; and whatever the user want to displayed is between round brackets and single/double inverted commas. The user can use either double or single inverted commas to display the output or the message. The difference between the two is minimal and will be explained at later stage in detail. In this example, the user displayed a message, or output a message. Another interesting fact is that there are two commands. Each command starts on a new line!
Activity 1 ¶
Write a statement where the computer greet you showing your name.
Write two statements where the compute greet you showing your name on one line and your surname on the next line.
Variables ¶
Python is very good at storing of data. To store data, either storing, using or recalling data. In Python there are a few different types. However, for a start the focus is on numbers and text only. Other types will be focused on at a later stage.
Numbers ¶
Python supports two types of numbers. The first is integers (7, 10, 12, 20000) and floating point numbers.
Integers ¶
To define integers, assignments are used:
In [4]:
myvalue=1 anothervalue=2 someintegervalue=20000
To view the content of the variables use the print statement.
In [16]:
print (myvalue) print (anothervalue) print (someintegervalue) print (myvalue, anothervalue)#Here we display more than one variable
1
2
20000
1 2
The output displays the values of the integers.
Float ¶
Assignment to float values are the same as with integers.
In [17]:
floatvalue = 1.3 anotherfloatvalue = 15.45 thirdfloatvalue = 123.64323
To view the contetnt of