Experts
Which of the following relational operators tests whether two values are equal to one another?
==
The random package has many functions for generating random numbers. There's a random
function defined in the random package, you can import and call using a function call expression
like so:
>>> from random import random >>> random()
Try calling the random function many times. What type does a call to the random function
evaluate to? <class 'float'>
The random package also has many functions for random selections. There's a choice function
defined in the random package, you can import and call using a function call expression with a
sequence as an argument, like so:
>>> from random import choice >>> choice("wxyz")
, Try calling the choice function many times and with different str values as input arguments.
What type does a call to the choice function evaluate to in these examples? <class
'string'>
The str class defines a method named isalpha for testing whether a string is made entirely of all
alphabetical characters. It also has a method named isdigit, whose documentation you can read
about here.
Given the three following expressions, what is the order of their evaluations?
>>> "comp110".isalpha() >>> "110".isdigit() >>> "comp110"[0].isalpha() False, True, True
What type of value does the input function always result in? str
The generic format of a variable declaration and initialization statement is the following:
A: B = C
What is A? The name of the variable being declared
The generic format of a variable declaration and initialization statement is the following:
A: B = C
What is B? The data type of the variable being declared