Engineering 102 Exams 1 & 2 TAMU Ijaz
Questions and Answers 100% Solved
What's the difference between % and // - ✔✔% returns the remainder // returns the quotient
without a remainder
how to make the variable var accessable outside of a function - ✔✔global var
first line after opening to read a csv file - ✔✔file_reader = csv.reader(file_name, delimiter=',')
lines to write in a csv file (after opening it) - ✔✔csv_writer = csv.writer(file_name, delimiter=' ')
csv_writer.writerow(['whatever'])
write a line that will make the x axis of a graph 0 through 15 - ✔✔x = np.linspace(0, 15)
Will this error?:
for i in range(2.0): - ✔✔YES (you can not use floats as a range)
Will this error?:
x = "abc" for i in range(x): - ✔✔YES (you can not use strings as a range) what is the output of
10/2? - ✔✔5.0 (/ returns a float no matter what)
what is the output of 10//5? - ✔✔2 (// always returns an int)
does % return a float or int? - ✔✔int
, multiply arrays A and B - ✔✔A@B
Create a dictionary called numbers where "one" = 1 and "two" = 2 - ✔✔numbers = {"one" : 1,
"two": 2}
call the key "one" from the dictionary numbers - ✔✔numbers["one"]
turn a list of integers called list into a list of floats in one line of code - ✔✔list = [float(i) for i in
list]
set the value num to a random number between x and y - ✔✔import random num =
random.randrange(x,y)
define compiler - ✔✔translates (compiles) source code written in a high-level language (e.g.,
Python) into a set of machine-language instructions that can be understood by a digital
computer's CPU
define IDE - ✔✔Integrated Development Environment — combines software development tools
under one GUI
define interpreter - ✔✔translates single line instruction into machine code
Complier vs. Interpreter - ✔✔Complier takes entire program as input Interpreter takes single
instruction as input
How do you put a special character into a string? (ex: ") - ✔✔\"
Questions and Answers 100% Solved
What's the difference between % and // - ✔✔% returns the remainder // returns the quotient
without a remainder
how to make the variable var accessable outside of a function - ✔✔global var
first line after opening to read a csv file - ✔✔file_reader = csv.reader(file_name, delimiter=',')
lines to write in a csv file (after opening it) - ✔✔csv_writer = csv.writer(file_name, delimiter=' ')
csv_writer.writerow(['whatever'])
write a line that will make the x axis of a graph 0 through 15 - ✔✔x = np.linspace(0, 15)
Will this error?:
for i in range(2.0): - ✔✔YES (you can not use floats as a range)
Will this error?:
x = "abc" for i in range(x): - ✔✔YES (you can not use strings as a range) what is the output of
10/2? - ✔✔5.0 (/ returns a float no matter what)
what is the output of 10//5? - ✔✔2 (// always returns an int)
does % return a float or int? - ✔✔int
, multiply arrays A and B - ✔✔A@B
Create a dictionary called numbers where "one" = 1 and "two" = 2 - ✔✔numbers = {"one" : 1,
"two": 2}
call the key "one" from the dictionary numbers - ✔✔numbers["one"]
turn a list of integers called list into a list of floats in one line of code - ✔✔list = [float(i) for i in
list]
set the value num to a random number between x and y - ✔✔import random num =
random.randrange(x,y)
define compiler - ✔✔translates (compiles) source code written in a high-level language (e.g.,
Python) into a set of machine-language instructions that can be understood by a digital
computer's CPU
define IDE - ✔✔Integrated Development Environment — combines software development tools
under one GUI
define interpreter - ✔✔translates single line instruction into machine code
Complier vs. Interpreter - ✔✔Complier takes entire program as input Interpreter takes single
instruction as input
How do you put a special character into a string? (ex: ") - ✔✔\"