Download D335 Introduction to Programming in Python with correct questions and answers and more Exams Information Technology in PDF only on Docsity!
D335 Answer:
Introduction to
Programming in Python
with correct questions
and answers
usr [COMPANY NAME] [Company address]
2 /
- 22.1 Lab Answer: 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 Answer: 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 Answer: 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 Answer: 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. Answer:
- 22.5 Lab Answer: Area of a Triangle Using Heron's formula, you can calculate the area of a triangle if you know the lengths of all three sides. Given the length of each side of a triangle as input, calculate the area of the triangle using Heron's formula as follows Answer: s = half of the triangle's perimeter area = the square root of s(s-a)(s-b)(s-c), where a, b, and c are each sides of the triangle. Answer:
- 22.6 Ordering Pizza
4 / to order as input, output the subtotal for the pizzas, and then output the total after applying a sales tax of 6% Answer:
- 22.7 LAB Answer: Square root Given a floating-point number as input, output the square root of the given number. Answer:
- 22.8 LAB Answer: Volume and area of cylinder The volume and area of a cylinder are calculated as Answer: 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. Answer:
- 22.9 LAB Answer: Warm up Answer: 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 Answer: Cooking Mesurement Converter Answer: