Docsity

D335 Programming Fundamentals Lab Exercises, Exams of Database Programming

Toggle sidebar
bg1
Page 1 of 6
D335/ WGU D335: INTRODUCTION TO
PROGRAMMING IN PYTHON NEWEST ACTUAL
EXAM QUESTIONS AND CORRECT VERIFIED
ANSWERS
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.
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.
pf3
pf4
pf5

Partial preview of the text

Download D335 Programming Fundamentals Lab Exercises and more Exams Database Programming in PDF only on Docsity!

D335/ WGU D335: INTRODUCTION TO

PROGRAMMING IN PYTHON NEWEST ACTUAL

EXAM QUESTIONS AND CORRECT VERIFIED

ANSWERS

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. 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.

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. 22.4 Lab: Hypotenuse Given two numbers that represent the lengths of a right triangle's legs (sides adjacent to the right angle), output the length of the third side (i.e. hypotenuse) with two digits after the decimal point.

22.7 LAB: Square root Given a floating-point number as input, output the square root of the given number. 22.8 LAB: Volume and area of cylinder The volume and area of a cylinder are calculated as: Volume = πr2h 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.

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. 22.10 LAB: Cooking Mesurement Converter