• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Exam (elaborations)

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

Document preview thumbnail
Preview 2 out of 7 pages

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

Content preview

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>")

Document information

Uploaded on
August 13, 2025
Number of pages
7
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$12.49

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

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.
CLOUNDLite
3.9
(132)
Sold
669
Followers
389
Items
12457
Last sold
22 hours ago



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