The purpose of these assignments is to help you review and apply important python modules and provide hands-on practice. Utilize the lab sessions to work on these exercises, and reach out to your Teaching Assistant (TA) or instructor for help. You have unlimited attempts to solve and resubmit these assignments on codePost.io, so use this opportunity to learn, experiment, and improve.
Write a program in Python that simulates the roll of a 6-sided die and an 8-sided die. Generate a random number for the 6-side die and store it in a variable named die1. Generate a random number for the 8-side die and store it in a variable named die2.
Provided code:import random ''' Put your code here ''' # Display the dice values (do not change the following line!) print("You rolled two dice:", die1, "and", die2)Note: Submit your code with the print("You rolled two dice:", die1, "and", die2) statement.
You have a square garden and want to build a fence around it. Write a program in Python that calculates the total length of fence you will need to surround the garden.
Your program should:
Please enter the area of the garden: 81 You will need 36.0 meters of fenceExample 2:
Please enter the area of the garden: 25 You will need 20.0 meters of fence
import math # Write your code here # Print the total meters of fence (do not change the following line!) print( "You will need", total_fence, "meters of fence" )Note: Submit your code with the print( "You will need", total_fence, "meters" ) statement.
Write a Python program that generates a random number between 10 and 20 (not including 10 and 20). Store the randomly generated number in a variable named number.
Provided code:# Write your code here # Display the number (do not change the following line!) print("The randomly generated number is:", number)Note: Submit your code with the print("The randomly generated number is:", number) statement. Do not change this line.
Write a Python program to display the value of the mathematical constant e supplied by the math module (see https://docs.python.org/3/library/math.html).
Write a Python program to display the value of the pi supplied by the math module (see https://docs.python.org/3/library/math.html).
For this assignment, write a Python program that calculates and displays the area of a pizza. Complete the Python program so that it
# Write your code here print("The area of the pizza is:", area)