Lab Topic 3 individual F23

.docx

School

Texas A&M University *

*We aren’t endorsed by this school

Course

102

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

1

Uploaded by ProfLightning103643 on coursehero.com

Lab: Topic 3 (individual) ENGR 102 – Fall 2023 Lab: Topic 3 (individual) Deliverables. Please complete the activity as described below. The activity is an individual assignment, but you may consult your teammates and others as you work. Please submit the following file to zyBooks. writing_functions.py Activity #1 : Writing functions – individual This activity provides practice for writing programs to perform multiple complex calculations, and to give you practice with writing and calling basic functions. Write a program that calculates the area of several regular polygons when given a side length. Your program should take as input from the user a value for side length and calculate the following values: The area of an equilateral triangle The area of a square The area of a regular pentagon The area of a regular dodecagon (12 sides) We’re going to ignore units for this problem. Define a function for each shape that calculates the area and generates the output according to the example shown below. Use two (2) decimal places for the side length and three (3) for the area. Write a single program that outputs all calculations named writing_functions.py . Before you beginning coding, you should stop and think briefly about how you want to structure your program. This activity is a great way to practice writing and calling functions. Example output (using input 1.25 ): Please enter the side length: 1.25 A triangle with side 1.25 has area 0.677 A square with side 1.25 has area 1.562 A pentagon with side 1.25 has area 2.688 A dodecagon with side 1.25 has area 17.494 Helpful Hint : When testing/debugging a program that requires input from the keyboard, it can be quite frustrating to have to retype the input every time you want to run the program. One technique for dealing with this problem is to simply “hard code” the variable values during the debugging process (assign variable values in the code rather that retrieving values from the keyboard), then add the code to retrieve the input from the keyboard after you are sure the code works. Based upon Dr. Keyser’s Original 1 Revised Fall 2023 SNR
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help