Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

INF1511-Python SUMMARY.

Rating
-
Sold
-
Pages
89
Uploaded on
25-11-2021
Written in
2021/2022

Phyton Powerful high-level, dynamic object-oriented programming INTRODUCTION Features of Python  Python is easy to learn.  It has easier to read syntax.  It uses white space to indent lines for defining blocks instead of using brackets.  Python is free.  It comes with a large number of libraries included, and there are many more that you can download and install.  Python can be integrated with other languages, like C, C++, and Java.  Python is an interpreted language, therefore it supports a complete debugging and diagnostic environment making the job of fixing mistakes much faster.  Python is a good choice for web development, networking, games, data processing, and business applications.  For efficient memory management, Python uses garbage collection, so you don’t have to worry about memory leaks.  Python supports exception handling. Interacting with Python  Using Command Line Mode  Using IDLE IDE Command Line Mode Since whatever you type in command line mode is not saved, it is better to save code in a file and then execute it. You can run Python programs from the command prompt. Open the command prompt and type python followed by the Enter key to open Python and tell it to run the script file, . IDLE (Integrated DeveLopment Environment) The program will be saved with extension .py. To execute the program, select Run Run Module or press the F5 key. Remember to add the .py extension when saving the file. Indentation Python uses indentation to express the block structure of a program. Unlike other languages, Python does not use braces or begin/end delimiters to denote blocks. Instead it uses indentation to represent blocks of statements. A block is a contiguous sequence of logical lines, all indented by the same amount, and a logical line with less indentation ends the block. The first statement in a block must have no indentation—it must not begin with any white space. You can use tabs or spaces to indent statements. Python replaces each tab with up to eight spaces. Don’t mix spaces and tabs for indentation, as tabs may be treated differently by different editors. Data Types in Python  Integers: Integers are 32 bits long, and their range is from –232 to 232 – 1 (i.e., from –2,147,483,648 to 2,147,483,647). INF1511-Python SUMMARY.  Long Integers: It has unlimited precision, subject to the memory limitations of the computer.  Floating Point Numbers: Floating-point numbers are also known as double-precision numbers and use 64 bits.  Boolean: It can hold only one of two possible values: True or False.  Complex Number: A complex number has a real and an imaginary component, both represented by float types in Python. An imaginary number is a multiple of the square root of minus one, and is denoted by j. For instance, 2+3j is a complex number, where 3 is the imaginary component and is equal to 3 × √−1.  Strings: Sequences of Unicode characters.  Lists: Ordered sequences of values.  Tuples: Ordered, immutable sequences of values.  Sets: Unordered collections of values.  Dictionaries: Unordered collections of key-value pairs. UNICODE Unicode uses 16 bits & represents characters by integer value denoted in base 16. ASCII (American Standard Code for Information Interchange) - 8 bits Mutable & immutable An object that can be altered is known as a mutable object, One that cannot be altered is an immutable object. BASIC ELEMENTS IN A PROGRAM Literals A number or string that appears directly in a program You can use both single and double quotes to represent strings. The strings that run over multiple lines are represented by triple quotes. 10 # Integer literal 10.50 # Floating-point literal 10.50j # Imaginary literal 'Hello' # String literal "World!" # String literal '''Hello World! It might rain today # Triple-quoted string literal Tomorrow is Sunday''' Variables Variables are used for storing data in a program. Keywords Python has 30 keywords, which are identifiers that Python reserves for special use. Keywords contain lowercase letters only. You cannot use keywords as regular identifiers.  and  assert  break  class  continue  def  del  elif  else  except  exec  finally  for  from  global  if  import  in  is  lambda  not Comments Comments are the lines that are for documentation purposes and are ignored by the interpreter. Use a (#). Continuation Lines A physical line is a line that you see in a program. A logical line is a single statement in Python terms. In Python, the end of a physical line marks the end of most statements If statement is too long to fit in single line: ensuring that the first physical line has no comment and ends with a backslash (). Python also joins adjacent lines into one logical line if an open parenthesis ( ( ), bracket ( [ ), or brace ( { ) is not closed. The lines after the first one in a logical line are known as continuation lines. The indentation is not applied to continuation lines but only to the first physical line of each logical line

Show more Read less
Institution
University Of South Africa
Course
INF1511 - Visual Programming I











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
University of South Africa
Course
INF1511 - Visual Programming I

Document information

Uploaded on
November 25, 2021
Number of pages
89
Written in
2021/2022
Type
SUMMARY

Subjects

$3.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ExellentStudyResources Chamberlain College Of Nursing
Follow You need to be logged in order to follow users or courses
Sold
1098
Member since
4 year
Number of followers
917
Documents
2076
Last sold
2 weeks ago

3.6

149 reviews

5
67
4
19
3
31
2
4
1
28

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions