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
Python. Easy Steps to Learning. Rating: 0 out of 5 stars0 ratingsAdvanced C++ Interview Questions You'll Most Likely Be Asked: Job Interview Questions Series Rating: 0 out of 5 stars0 ratingsAmazing Java: Learn Java Quickly Rating: 0 out of 5 stars0 ratingsMission Ruby Rating: 0 out of 5 stars0 ratingsPHP programming Rating: 0 out of 5 stars0 ratingsPython: Advanced Guide to Programming Code with Python: Python Computer Programming, #4 Rating: 0 out of 5 stars0 ratingsPython: Advanced Guide to Programming Code with Python Rating: 0 out of 5 stars0 ratingsProgramming with Python Rating: 0 out of 5 stars0 ratingsC++ Programming Language Rating: 0 out of 5 stars0 ratingsPYTHON CODING AND PROGRAMMING: Mastering Python for Efficient Coding and Programming Projects (2024 Guide for Beginners) Rating: 0 out of 5 stars0 ratingsJavascript - 50 functions and tutorial Rating: 0 out of 5 stars0 ratingsLearn Programming Using C# Rating: 0 out of 5 stars0 ratingsJust the basics of JavaScript Rating: 0 out of 5 stars0 ratingsGd Script Rating: 0 out of 5 stars0 ratingsPython For Beginners Rating: 0 out of 5 stars0 ratingsGood Habits for Great Coding: Improving Programming Skills with Examples in Python Rating: 0 out of 5 stars0 ratingsC Programmin Language Rating: 0 out of 5 stars0 ratingsPython from the Very Beginning Rating: 0 out of 5 stars0 ratingsPython Programming for Beginners Crash Course with Hands-On Exercises, Including NumPy, Pandas and Matplotlib Rating: 0 out of 5 stars0 ratingsUltimate Ios 10, Xcode 8 Development Book: Build 30 Apps Rating: 0 out of 5 stars0 ratingsIntroduction to PHP, Part 2, Second Edition Rating: 0 out of 5 stars0 ratingsCollection of Raspberry Pi Projects Rating: 5 out of 5 stars5/5Coding for beginners The basic syntax and structure of coding Rating: 0 out of 5 stars0 ratingsC Language Programming Codes Rating: 0 out of 5 stars0 ratingsLearn C++ Rating: 4 out of 5 stars4/5Basic Exercises for Competitive Programming: Python Rating: 0 out of 5 stars0 ratings"C Programming for Beginners: A Step-by-Step Guide" Rating: 0 out of 5 stars0 ratingsSummary of Jimmy Song's Programming Bitcoin Rating: 0 out of 5 stars0 ratingsC++ Functions and tutorial Rating: 0 out of 5 stars0 ratingsProfound Python Data Science Rating: 0 out of 5 stars0 ratings
Programming For You
Game Development with Unreal Engine 5: Learn the Basics of Game Development in Unreal Engine 5 (English Edition) Rating: 0 out of 5 stars0 ratingsPython: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps 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/5Modern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratingsSQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5The Unofficial Guide to Open Broadcaster Software: OBS: The World's Most Popular Free Live-Streaming Application Rating: 0 out of 5 stars0 ratingsSQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsExcel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Web Designer's Idea Book, Volume 4: Inspiration from the Best Web Design Trends, Themes and Styles Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Beginning Programming with Python For Dummies Rating: 3 out of 5 stars3/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5Problem Solving in C and Python: Programming Exercises and Solutions, Part 1 Rating: 5 out of 5 stars5/5
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