Question

In: Computer Science

What data type will Python pick for the following variable? radio = '101.5' A. integer (i.e....

What data type will Python pick for the following variable?

radio = '101.5'

A.

integer (i.e. int)

B.

string (i.e. str)

C.

floating point number (i.e. float)

D.

list

Which of the following Python statements changes the first element of a tuple my_tuple to 17?

A.

my_tuple[0] = 17

B.

my_tuple[0] == 17

C.

both (A) and (B)

D.

none of the above

Suppose there are two sections of CSC121 and each section has 10 students. Their midterm exam scores are stored in two lists score_list1 and score_list2. Which of the following Python program fragments displays all these midterm exam scores?

A.
combined_list = [score_list1, score_list2]
for element in combined_list:
    for score in element:
        print (score)
B.
combined_list = score_list1 + score_list2
for element in combined_list:
    print (element)
C.

both (A) and (B)

D.

none of the above

def main():

    age = float(input('Enter age: '))

    # insert statement here to call the buffet_price function

    print('Please pay $', price)

def buffet_price(age):

    if age >= 60 or age <= 10:

        price = 9

    else:

        price = 12

    return price

main()

Which of the following statements should be used to call the buffet_price function?

A.

buffet_price(price, age)

B.

buffet_price(age, price)

C.

price = buffet_price(age)

D.

age = buffet_price(price)

Solutions

Expert Solution


Related Solutions

Identify the variables in the raw data and indicate the type of each variable (i.e., nominal,...
Identify the variables in the raw data and indicate the type of each variable (i.e., nominal, ordinal, count or continuous; don’t worry about distinguishing ratio versus interval). Assume for this purpose that all the observations for a given paper plane are recorded in a single row. Variables : Design, Material, Maker, Thrower, Distance Type: ?
Update the function playScratchOffs to do the following Declare an integer variable to store the type...
Update the function playScratchOffs to do the following Declare an integer variable to store the type of scratch off (i.e. type) Declare an integer variable to store the number of scratch off (i.e. count) Declare an integer variable for loop control (i.e. c) Declare a variable of data type struct OneDollar (i.e. oneSO) Declare a variable of data type struct TwoDollar (i.e. twoSO) Declare a variable of data type struct FiveDollar (i.e. fiveSO) Write a series of printf statements to...
1.) What type of data is stored in a pointer? a. an integer b. a character...
1.) What type of data is stored in a pointer? a. an integer b. a character c. A memory address d. None of the above 2.) A stack in used to implement method calls in a program. True or Flase?
Consider the following experiment. Pick a random integer from 1 to 1012. (a) What is the...
Consider the following experiment. Pick a random integer from 1 to 1012. (a) What is the probability that it is either a perfect square (1, 4, 9, 16, ...) or a perfect cube (1, 8, 27, 64,...)? (b) What is the probability that it is either a perfect fourth power (1, 16, 81, 256, ...) or a perfectsixth power (1, 64, 729, 4096,...)?
Consider the following experiment. Pick a random integer from 1 to 10^12 . (a) What is...
Consider the following experiment. Pick a random integer from 1 to 10^12 . (a) What is the probability that it is either a perfect square (1, 4, 9, 16, …) or a perfect cube (1, 8, 27, 64,…)? (b) What is the probability that it is either a perfect fourth power (1, 16, 81, 256, …) or a perfect sixth power (1, 64, 729, 4096,…)?
A radio executive considering a switch in his radio format collects the following data on the...
A radio executive considering a switch in his radio format collects the following data on the radio preferences of listeners in various age groups. Radio preference Age Young adult Middle Age Older adult Music 14 10 3 News/talk 4 15 11 Sports 7 9 5 Test the null hypothesis that radio preference does not vary by age. Use a .05 confidence level for your test and report (a) the critical value of the test statistic, (b) the obtained value of...
What is a variable type? Name three variable types, explain what each type represents, and provide...
What is a variable type? Name three variable types, explain what each type represents, and provide an example of how you might use each one.
Python 1.)Assume that name is a variable of type String that has been assigned a value....
Python 1.)Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is the last character of the value of name. So if the value of name were "Blair" the expression's value would be 'r'. 2.)Assume that word is a variable of type String that has been assigned a value. Write an expression whose value is a String consisting of the last three characters of the value of word. So if...
Write some python programs which demonstrate the following concepts: Input data of all the variable types...
Write some python programs which demonstrate the following concepts: Input data of all the variable types we've covered so far (https://realpython.com/python-variables/) Test input of strings with various quoting styles as previously discussed Output all the variables you read. Format output of all variables to create columnar output. Format output of numbers to 2 decimal places Output using both the string formatting and the 'f' formatted string literals notation. TURN IN Submit your source code and execution of your code.
1) type a complete, working, C++ program that accepts two integer values from the variable num3,...
1) type a complete, working, C++ program that accepts two integer values from the variable num3, and store num1 raised to the power num2 into the variable num4. Then output the values of the four variables each on a separate line, formatted and with an appropriate message for each.keyboard into the variables num1 and num2, include prompts, store the square root of their sum into the program :
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT