Sheet of paper in millimeters [closed]

2024/7/7 5:58:33

I been asked to write a program that displays the dimensions of a letter-size (8.5 x 11 inches) sheet of paper in millimetres. There are 25.4 millimetres per inch. I need to use constants and comments in my program. This is what I come up with:

#This is a program that displays dimensions of a letter-size
#sheet of paper in millimeters.
# Conversion from inches to millimeters.
# w = 8.5 inches * 25.4mm/inch = 215.9 mm
# h = 11 inches *25.4mm/inch = 279.4 mm
# Define constants
WIDTH_IN_MILLIMETERS = 215.9
HEIGHT_IN_MILLIMETERS = 279.4#Compute and print dimmensions of a letter-size sheet of paper in millimeters.
dimLetterSize = WIDTH_IN_MILLIMETERS * HEIGHT_IN_MILLIMETERSprint("The dimentions of a letter-size sheet of paper in millimeters: %6d" % dimLetterSize)
Answer

Here is my answer to your assignment. I hope you get full marks.

# This is a program that displays dimensions of a letter-size
# sheet of paper in millimeters.WIDTH = 8.5
HEIGHT = 11MILLIMETERS_IN_INCHES = 25.4print("The dimentions of a letter-size sheet of paper in millimeters is : {} x {}", WIDTH * MILLIMETERS_IN_INCHES, HEIGHT * MILLIMETERS_IN_INCHES)
https://en.xdnf.cn/q/120619.html

Related Q&A

Kivy App build with Buildozer. APK crash

I am using Oracle VirtualBox running Ubuntu 16. I have been able to build apk files for a while until my latest build. My program will run and keep its functionality when run with python 2.7 on the sam…

Python3 - convert csv to json using pandas

Ive got a .csv files with 5 columns but I only need the json file to contain 3 of these how would i go about doing it?csv file:Ncode Ocode name a b c 1 1.1 1x 1a 1b 1…

Python List of Dictionaries by Loops

I have 2 python list of dictionaries:[{index:1,color:red},{index:2,color:blue},{index:3,color:green} ]and[{device:1,name:x},{device:2,name:y},{device:3,name:z} ]How can I append each dictionary from th…

Removing parentheses and comma

Im importing Data from a database into python data frame. Now, I wish to use the data for further analysis, however, I need to do a little cleaning of the data before using. Currently, the required col…

Explicit Exception problem with try function

I have to run codes irrespective whether it fails or not. Im using ExplicitException. Following is my code:try:G.add_edge(data1[0][0],data1[1][0],weight=data1[2+i][0]) except ExplicitException:passtry:…

How do I perform a bubble sort in Python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.Closed 4 years ago.Improve…

check if number is between row of numpy array

Want to check if value is between the row of array. here the value 347 is in between the 1st row of aa but not second , so how to check for it ? aa= np.array([[348 ,345],[460 , 459 ]])value = 347prin…

Print a word diagonally? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to repro…

Click a button using Selenium and Python

I have the following code: <a class="sectionname" href="#" onclick="expandAll();return false;">Expand all</a> When I click on expand all, the whole page loads…

how to do Json format [duplicate]

This question already has answers here:How to store ner result in json/ database(2 answers)Closed 8 years ago.(S(PERSON Rami/NNP Eid/NNP)is/VBZstudying/VBGat/IN(ORGANIZATION Stony/NNP Brook/NNP Univers…