• ¿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 1 fuera de 4 páginas
Examen

Intro To Programming Python

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

INTRO TO PROGRAMMING PYTHON List - CORRECT ANSWER-A Python data type that holds an ordered collection of values, which can be of any type. This is equivalant to an "array" in many other languages. Python lists are "mutable," implying that they can be changed once created. Variables - CORRECT ANSWER-Variables are assigned values using the '=' operator, which is not to be confused with the '==' sign used for testing equality. A variable can hold almost any type of value such as lists, dictionaries, functions. Functions - CORRECT ANSWER-Python builds functions using the syntax: def function_name(variable): Functions can be stand-alone or can return values. Functions can also contain other functions. Strings - CORRECT ANSWER-Strings store characters and have many built-in convenience methods that let you modify their content. The len() Function - CORRECT ANSWER-Using len(some_object) returns the number of _top-level_ items contained in the object being queried. Length of string Print - CORRECT ANSWER-A function to display the output of a program. Using the parenthesized version is arguably more consistent. The range() Function - CORRECT ANSWER-The range() function returns a list of integers, the sequence of which is defined by the arguments passed to it. Used in for loops. While Loops - CORRECT ANSWER-A While loop permits code to execute repeatedly until a certain condition is met. This is useful if the number of iterations required to complete a task is unknown prior to flow entering the loop. The str() Function - CORRECT ANSWER-Using the str() function allows you to represent the content of a variable as a string, provided that the data type of the variable provides a neat way to do so. str() does not change the variable in place, it returns a 'stringified' version of it. raw_input() - CORRECT ANSWER-function that enabled the user to insert their string. Now obsolete input() - CORRECT ANSWER-function that enables user to insert data as a string sort method - CORRECT ANSWER-() method is used to sort a list. Distinguish method vs. a built in function - CORRECT ANSWER-function has curly braces after it, method has .'dot' notation. Why use classes? - CORRECT ANSWER-Python is an object-oriented programming language, which means it manipulates programming constructs called objects. You can think of an object as a single data structure that contains data as well as functions Class Syntax - CORRECT ANSWER-•call class then class name (parameter) • then create a function def__init with 'self' as the 1st parameter comma then 2nd parameters. •call = name and ation = occupation •create a new variable and have it equal to your example object and use built in parameters to build your objects parameters. Methods - CORRECT ANSWER-When a class has its own functions, those functions are called methods. You've already seen one such method: __init__(). Functions - CORRECT ANSWER-Functions are a convenient way to divide your code into useful blocks, allowing us to order our code, make it more readable, reuse it and save some time. Also functions are a key way to define interfaces so programmers can share their code. Objects - CORRECT ANSWER-Objects are an encapsulation of variables and functions into a single entity. Objects get their variables and functions from classes. Classes are essentially a template to create your objects. List - CORRECT ANSWER-A Python data type that holds an ordered collection of values, which can be of any type. This is equivalant to an "array" in many other languages. Python lists are "mutable," implying that they can be changed once created. Variables - CORRECT ANSWER-Variables are assigned values using the '=' operator, which is not to be confused with the '==' sign used for testing equality. A variable can hold almost any type of value such as lists, dictionaries, functions. Functions - CORRECT ANSWER-Python builds functions using the syntax: def function_name(variable): Functions can be stand-alone or can return values. Functions can also contain other functions. Strings - CORRECT ANSWER-Strings store characters and have many built-in convenience methods that let you modify their content. The len() Function - CORRECT ANSWER-Using len(some_object) returns the number of _top-level_ items contained in the object being queried. Length of string Print - CORRECT ANSWER-A function to display the output of a program. Using the parenthesized version is arguably more consistent. The range() Function - CORRECT ANSWER-The range() function returns a list of integers, the sequence of which is defined by the arguments passed to it. Used in for loops. While Loops - CORRECT ANSWER-A While loop permits code to execute repeatedly until a certain condition is met. This is useful if the number of iterations required to complete a task is unknown prior to flow entering the loop. The str() Function - CORRECT ANSWER-Using the str() function allows you to represent the content of a variable as a string, provided that the data type of the variable provides a neat way to do so. str() does not change the variable in place, it returns a 'stringified' version of it. raw_input() - CORRECT ANSWER-function that enabled the user to insert their string. Now obsolete input() - CORRECT ANSWER-function that enables user to insert data as a string sort method - CORRECT ANSWER-() method is used to sort a list. Distinguish method vs. a built in function - CORRECT ANSWER-function has curly braces after it, method has .'dot' notation. Why use classes? - CORRECT ANSWER-Python is an object-oriented programming language, which means it manipulates programming constructs called objects. You can think of an object as a single data structure that contains data as well as functions Class Syntax - CORRECT ANSWER-•call class then class name (parameter) • then create a function def__init with 'self' as the 1st parameter comma then 2nd parameters. •call = name and ation = occupation •create a new variable and have it equal to your example object and use built in parameters to build your objects parameters. Methods - CORRECT ANSWER-When a class has its own functions, those functions are called methods. You've already seen one such method: __init__(). Functions - CORRECT ANSWER-Functions are a convenient way to divide your code into useful blocks, allowing us to order our code, make it more readable, reuse it and save some time. Also functions are a key way to define interfaces so programmers can share their code. Objects - CORRECT ANSWER-Objects are an encapsulation of variables and functions into a single entity. Objects get their variables and functions from classes. Classes are essentially a template to create your objec


Información del documento

Subido en
20 de noviembre de 2023
Número de páginas
4
Escrito en
2023/2024
Tipo
Examen
Contiene
Preguntas y respuestas
$9.49

¿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.
Bestcontents
4.5
(8)
Vendido
34
Seguidores
13
Artículos
2030
Última venta
10 meses 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.