Docsity

Python Programming Exercises: Introduction to Python, Exams of Advanced Education

Partial preview of the text

Download Python Programming Exercises: Introduction to Python and more Exams Advanced Education in PDF only on Docsity!

WGU D335:

INTRODUCTION TO

PROGRAMMING IN

PYTHON (INTRO TO

PYTHON)

WGU D

Evatee 7/14/24 WGU D

WGU D335: INTRODUCTION TO PROGRAMMING IN PYTHON (INTRO TO PYTHON) 22.1 Lab: Convert to Seconds Write a program that reads in hours, minutes, and seconds as input, and outputs the time in seconds only. Answer - 22.2 Lab: Convert from Seconds People find it easier to read time in hours, minutes, and seconds rather than just seconds. Write a program that reads in seconds as input and outputs the time in hours, minutes, and seconds. Answer - 22.3 Lab: Pizza Party Given the number of people attending a pizza party, output the number of needed pizzas and total cost. For the calculation, assume that people eat 2 slices on average and each pizza has 12 slices and costs $14.95. Answer - 22.4 Lab: Hypotenuse

Area = 2πrh + 2πr Given the radius and height of a cylinder as floating-point numbers, output the volume and area of the cylinder. Answer - 22.9 LAB: Warm up: Variables, input, and type conversion (1) Prompt the user to input an integer between 32 and 126, a float, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space. (2) Extend to also output in reverse. (3) Extend to convert the integer to a character by using the 'chr()' function, and output that character. Answer - 22.10 LAB: Cooking Mesurement Converter Answer -