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

TAMU ENGR 102 (python coding) Comprehensive Q&A Study Guide with Complete Solutions

Document preview thumbnail
Vista previa 2 fuera de 7 páginas

TAMU ENGR 102 (python coding) Comprehensive Q&A Study Guide with Complete Solutions This document is a complete set of Python programming questions and answers tailored for Texas A&M University’s ENGR 102 course. It covers key concepts such as syntax, loops, functions, file handling, data types, list slicing, dictionary usage, exception handling, and basic turtle graphics. The material also includes practical coding examples, explanations of common errors, and concise definitions of essential programming terms. Ideal for exam review and practice. Keywords: python syntax for loop while loop function definition list slicing dictionary access file reading file writing exception handling mutable data types immutable data types turtle graphics boolean values data types logic errors syntax errors runtime errors

Vista previa del contenido

TAMU ENGR 102 (PYTHON CODING)
COMPREHENSIVE Q&A STUDY GUIDE WITH
COMPLETE SOLUTIONS
!= - ANSWER-inequality

== - ANSWER-equal to

a -= 3 - ANSWER-a = a - 3

a=0
while a == 0:
print("About to change a")
a=1
print("Changing a back to 0")
a = 0 - ANSWER-About to change a
Changing a back to 0
About to change a
Changing a back to 0
... (an infinite loop)

a = 10
b = 10
c = 20
d = ((a>b) and (b<=c)) or (not((((c<=a+b) and (a==10)) or ((b==10) and c!=10))))
print(d) - ANSWER-false

converting csv file to dataframe - ANSWER-pd.read_csv(filepath)

create numpy array - ANSWER-np.array(list, type)

defF(a):
a += 1
return a
a += 10
return a
x = F(4)
print(x) - ANSWER-5

difference between lists, tuples, and arrays - ANSWER-lists use brackets, tuples use
either parentheses or commas, arrays you can manipulate each individual character

difference btwn <string variable> = <fileID>.readline() and <string variable> =
<fileID>.read() - ANSWER-.read() will read the entire file into one single string which
could be problematic bc it can be a REALLY large string.

, .readline() will convert all the lines in the file into a list of strings and each element of the
list is a string, giving one line of the program.

different formats for reading files - ANSWER-<string variable> = <fileID>.readline()
<string variable> = <fileID>.read()

examples of built-in functions - ANSWER--print()
-input()
-float()
-open()
-len()

file basics - ANSWER-•first "open" the file (specify how we will work with the file)
•then, work with the file contents (reading/writing)
•finally, "close" the file

float(3) - ANSWER-value becomes 3.0

for i in range(10):
if i%2 == 1:
continue
print("i is", i) - ANSWER-i is 0
i is 2
i is 4
i is 6
i is 8

for i in range(3):
print("i is", i)
for j in range(3):
print(" j is", j)
break - ANSWER-i is 0
j is 0
i is 1
j is 0
i is 2
j is 0

form of a function call - ANSWER-<function name>(<arguments>)

format for defining a function - ANSWER-def <function name>(<parameters>):
<stuff to do>

format for opening files - ANSWER-<fileID> = open("<File Name>", "<designator>")

Información del documento

Subido en
13 de agosto de 2025
Número de páginas
7
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$12.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.
CLOUNDLite
3.9
(132)
Vendido
669
Seguidores
389
Artículos
12457
Última venta
22 horas 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