Hi, this is just an ungraded review guide for my python class. I want to do well on the exam so I am just seeking help because I struggle in some areas. Thank you for your help. QUESTION 1 Given the following statement that calls an object's method, what is the name of the object? What is the name of the method? fridge.get_food() QUESTION 2 The following statements call a function named makeHalf, which returns a value that is half of the argument that was passed to it. Write the code for the makeHalf function. number = 7.75 Result = makeHalf(number) QUESTION 3 Write nested decision structures that perform the following: If Amount1 is greater than 20 and Amount2 is less than 75, display the greater of Amoun1 and Amount2.
Hi, this is just an ungraded review guide for my python class. I want to do well on the exam so I am just seeking help because I struggle in some areas. Thank you for your help. QUESTION 1 Given the following statement that calls an object's method, what is the name of the object? What is the name of the method? fridge.get_food() QUESTION 2 The following statements call a function named makeHalf, which returns a value that is half of the argument that was passed to it. Write the code for the makeHalf function. number = 7.75 Result = makeHalf(number) QUESTION 3 Write nested decision structures that perform the following: If Amount1 is greater than 20 and Amount2 is less than 75, display the greater of Amoun1 and Amount2.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Hi, this is just an ungraded review guide for my python class. I want to do well on the exam so I am just seeking help because I struggle in some areas. Thank you for your help.
QUESTION 1
QUESTION 1
Given the following statement that calls an object's method, what is the name of the object? What is the name of the method?
fridge.get_food()
QUESTION 2
The following statements call a function named makeHalf, which returns a value that is half of the argument that was passed to it. Write the code for the makeHalf function.
number = 7.75
Result = makeHalf(number)
QUESTION 3
Write nested decision structures that perform the following: If Amount1 is greater than 20 and Amount2 is less than 75, display the greater of Amoun1 and Amount2.
QUESTION 4
Write a function that accepts a list as an argument (assume the list contains integers) and returns the total of the values in the list.
QUESTION 5
Write the first line of the definition for a Laborador class that will extend the Dog class.
QUESTION 6
Write an if statement that assigns 100 to the variable apple then assigns 50 to the variable carrot if the variable apple is greater than 100.
QUESTION 7
Write a Python statement that creates a Label widget. Its parent should be self.main_ window and its text should be 'Happy New Year!'.
QUESTION 8
What will the following code display?
shortstring = 'the fox jumped over the log'
print(shortstring[3:6]
QUESTION 9
Write a while loop that lets the user enter a number. The number should be mulutiplied by 10, and the result assigned to a variable named Product. The loop should repeat as long as Product is less than 100.
QUESTION 10
What will the following code display on the screen?
def main():
x = 3
y = 5.5
print(x, y)
change_it(x, y)
print(x, y)
def chang_it(a, b):
a = 1
b = 1
print(a, b)
main()
QUESTION 11
Write Python code that does the following: opens an output file with the file name numberList.txt, then uses a loop to write the numbers 1 through 50 to the file, then closes the file.
QUESTION 12
What string method would you use to return a copy of a string with all leading and trailing whitespaces removed?
QUESTION 13
Describe the difference between a list and a tuple. Provide an example of when you might use each, and explain why.
QUESTION 14
Write a class definition named Article. The Article class should have data attributes for the article's title, the author's name, and the publisher's name. The class should also have the following:
An __init__ method for the class which will accept an argument for each of the data attributes.
Accessor and mutator methods for each data attribute
An __str__ method that returns a string indicating the state of the object.
QUESTION 15
Write a set of nested loops that display 10 rows of % characters. There should be 10 % characters displayed in each row.
QUESTION 16
Write Python code that prompts the user to enter their favorite color and assigns the user's input to the variable named FavColor.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education