• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 4 fuera de 89 páginas
Resumen

Inf1511-Python Summary.

Document preview thumbnail
Vista previa 4 fuera de 89 páginas

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


Información del documento

Subido en
25 de noviembre de 2021
Número de páginas
89
Escrito en
2021/2022
Tipo
Resumen
$3.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Vendido
1102
Seguidores
917
Artículos
2065
Última venta
1 semana hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes

Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.