Python

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Python divides the operators in the following groups:

Arithmetic operators Assignment operators Comparison operators Logical operators Identity operators Membership operators Bitwise operators

literal

(of a translation) representing the exact words of the original text.

Variable Names

A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for Python variables: A variable name must start with a letter or the underscore character A variable name cannot start with a number A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) Variable names are case-sensitive (age, Age and AGE are three different variables)

Python Comments

Comments can be used to explain Python code. Comments can be used to make the code more readable. Comments can be used to prevent execution when testing code.

Complex

Complex numbers are written with a "j" as the imaginary part

Float

Float can also be scientific numbers with an "e" to indicate the power of 10.

Python Operators

Operators are used to perform operations on variables and values.

Good to know

The most recent major version of Python is Python 3, which we shall be using in this tutorial. However, Python 2, although not being updated with anything other than security updates, is still quite popular. In this tutorial Python will be written in a text editor. It is possible to write Python in an Integrated Development Environment, such as Thonny, Pycharm, Netbeans or Eclipse which are particularly useful when managing larger collections of Python files.

Python Numbers

There are three numeric types in Python: int float complex

PC (in common use)

the term PC has typically meant a computer running the Windows operating system, not the operating system made by Apple, Inc.

Python Strings

String literals in python are surrounded by either single quotation marks, or double quotation marks.

String variables

String variables can be declared either by using single or double quotes:

Int

Int, or integer, is a whole number, positive or negative, without decimals, of unlimited length.

It is used for:

-web development (server-side), -software development, -mathematics, -system scripting.

Float

Float, or "floating point number" is a number, positive or negative, containing one or more decimals.

What can python do?

Python can be used on a server to create web applications. Python can be used alongside software to create workflows. Python can connect to database systems. It can also read and modify files. Python can be used to handle big data and perform complex mathematics. Python can be used for rapid prototyping, or for production-ready software development.

What is python?

Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.

Python Syntax compared to other programming languages

Python was designed for readability, and has some similarities to the English language with influence from mathematics. Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses. Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.

Why python?

Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc). Python has a simple syntax similar to the English language. Python has syntax that allows developers to write programs with fewer lines than some other programming languages. Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick. Python can be treated in a procedural way, an object-orientated way or a functional way.

Python Variables

Variables are containers for storing data values. Unlike other programming languages, Python has no command for declaring a variable. A variable is created the moment you first assign a value to it.

hexadecimal

base b=16

octal

base b=8

PC (in the strictest definition)

stands for personal computer.


Set pelajaran terkait

Abdomen Board Exam: Ch. 6 - Spleen

View Set

respuestas antes de un quizz y quizzes !!! ( 91% - 100 % )

View Set

Introduction to Mastering Anatomy and Physiology

View Set