Picture8.jpg
Blog
Picture23.jpg
Picture23.jpg
Picture19.jpg
Picture19.jpg
Picture4.jpg
Picture4.jpg
Picture5.jpg
Picture5.jpg
Write a program that asks the user to enter a sentence. The…
Write a program that asks the user to enter a sentence. The program should reverse the order of the words in the sentence and display the result. Do not reverse the characters in the words, only the word order. Source Code: def reverse_sentence( 1 ): words = sentence. 2 () reversed_words = 3 [::-1] return ‘ ‘.join( 4 ) user_input = input(“Enter a sentence: “) result = 5 (user_input) print(“Reversed sentence:”, result)
Write a program that displays the following information abou…
Write a program that displays the following information about a movie: Title: Shadows of the Horizon Director: Riley Bennett Release Year: 2015 Genre: Drama Duration: 132 minutes Source Code: # Movie Information Display 1 (“Movie Information”) print(“——————“) print(“Title: Shadows of the Horizon”) print(” 2 “) print(“Release Year: 2015”) print(“Genre: Drama”) 3 (” 4 “)
Write a program that asks the user to enter the radius of a…
Write a program that asks the user to enter the radius of a circle and then calculates and displays the area using the formula: Area = π × r² Use 3.14159 for π. Source Code: # Circle Area Calculator radius = 1 (input(“Enter the radius of the circle: “)) pi = 2 area = 3 * 4 ** 5 print(f”The area of the circle is: {area:.2f}”)
Suppose a problem situation describes a speed in km/h and a…
Suppose a problem situation describes a speed in km/h and a length in m. What conversion should you do before substituting quantities for symbols?
Write a class named Employee that has the following data att…
Write a class named Employee that has the following data attributes: __name (employee name) __id_number (employee ID number) __department (employee department) __job_title (employee job title) The class should include an __init__ method to initialize the attributes and should also include accessor (get) and mutator (set) methods for each attribute. Write a program that prompts the user to enter information about an employee and then displays the stored data. Source Code: class Employee: def __init__( 1 , 2 , 3 , 4 , 5 ): self.__name = name self.__id_number = id_number self.__department = department 6 .__job_title = job_title def set_name(self, name): self.__name = name def set_id_number(self, id_number): self.__id_number = id_number def 7 (self, department): self.__department = department def set_job_title(self, job_title): self.__job_title = job_title def get_name( 8 ): return self.__name def 9 (self): return self.__id_number def get_department(self): return self.__department def get_job_title(self): return self.__job_title # Program to use the class name = input(“Enter employee’s name: “) id_number = input(“Enter employee ID number: “) department = input(“Enter department: “) job_title = input(“Enter job title: “) emp = Employee(name, id_number, department, job_title) print(“\nEmployee Information:”) print(“Name:”, emp.get_name()) print(“ID Number:”, emp.get_id_number()) print(“Department:”, 10 ()) print(“Job Title:”, emp.get_job_title())