Question
If we add a name to the list Beatles in the code below, what happens to the list name? name = [John, Paul, George] beatles
If we add a name to the list Beatles in the code below, what happens to the list name?
name = ["John", "Paul", "George"] beatles = first name
Write a good commit message for the changes in the following code:
#Code before commit:
def main(): radius = float(input("input_radius")) area = 3.14*radius*radius print("The area of the circle is { }".format(area)
For each scenario below, explain what data structure (Python variable type) is the best choice and why.
a. Store pairs of names and phone numbers. b. Store a student's age. c. Store patient details (height, weight, medication, etc.). This cannot be changed. d. Store the total cost of a shopping list. e. Store whether a date is a public holiday.
Given the classes below, describe their relationship using the following options:
is unrelated to
is an instance of
is a child of
is composed of
Example 1: Animal Dog The relationship between Dog is "Dog is a child of Animal" Note that you may need to swap the order using the relationships provided.
a. Library-books b. Bank Account - Fixed Account c. pen-travel d. jim-person
Consider a class that represents a bicycle.
Write the most appropriate name for each of the following parts of the class:
a. the module (file) name b. the "class name" name c. a way to change gears d. Attribute variable for the lower brake, and an attribute variable that provides the level of the driving gear [0 to 5]
Given the following code to open a file:
some_file = open('test.txt', 'r')
Explain the return value of the following statement (note the s in the second method name).
a. some_file. readline() b. some_file. readlines()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started