1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Katarina [22]
3 years ago
7

2.3 Code Practice: Question 2 Write a program that inputs the length of two pieces of fabric in feet and inches (as whole number

s) and prints the total.
Computers and Technology
2 answers:
Sati [7]3 years ago
8 0

Answer:

ft1= int(input("Enter the Feet: "))

in1= int(input("Enter the Inches: "))

ft2= int(input("Enter the Feet: "))

in2= int(input("Enter the Inches: "))

totalft= ft1 + ft2 + int((in1+in2)/12)

totalin= (in1+in2) % 12

print("Feet: " + str(totalft) + " Inches: " + str(totalin))

9966 [12]3 years ago
4 0

Answer:

This is written using Python 3:

<em />

<em>fft = input("How many feet for Fabric A? ") </em>

<em>fin = input("How many inches for Fabric A? ") </em>

<em>sft = input("How many feet for Fabric B? ") </em>

<em>sin = input("How many inches for Fabric B? ")</em>

<em> </em>

<em>print("Length for Fabric A is:", fft, "feet and", fin, "inches") </em>

<em>print("Length for Fabric B is:", sft, "feet and", sin, "inches")</em>

<em />

INPUT:

How many feet for Fabric A? 5

How many inches for Fabric A? 5

How many feet for Fabric B? 1

How many inches for Fabric B? 1

OUTPUT:

Length for Fabric A is: 5 feet and 5 inches

Length for Fabric B is: 1 feet and 1 inches

<em />

Explanation:

First is to declare the variables:

  • fft - stands for First Feet
  • fin - stands for First Inches
  • sft - stands for Second Feet
  • sin - stands for Second Inches

Then we ask the user to input a value by using:

  • input()

By using this, you can add a label inside ( and ) to provide guidance to the user. As such, I wrote "How many feet for Fabric A?"

After which, we print the answers for Fabric A and B.

  • print("TEXT HERE") - this is the simplest way to print a string. If you want to print an integer or variables, you don't have to include the quotation marks.

But what if you want to print both string and variables on the same line?

In which case, you can write it this way:

  • print("TEXT HERE", VARIABLE)

What this does is it concatenates the string and the variable in one go. After the quotation marks, simply add a comma right after. There are other ways of doing this but this is the most straightforward answer.

Now, repeat the process to print the entire sentence:

  • print("TEXT 1:", VARIABLE1, "TEXT 2", VARIABLE2)

Important Note:

If you need to do calculations (+, *, /, -, %) it is important to convert the inputs into integers or floats. Using the answer above:

  • fft = input("How many feet for Fabric A? ")  - the value entered here is only considered as a string.
  • fft = int(input("How many feet for Fabric A? ") ) - meanwhile, by enclosing input() inside int(), this effectively becomes an integer. You may also use float() when necessary.
  • In which case, you can add, subtract, multiply, and divide the variables.
You might be interested in
5. You have been putting off writing a research paper, and now it's due in two days. You have gathered
DiKsa [7]
You should use the website most of the sites that u pay for an essay on will have plagiarism checkers and the essays should be new !
6 0
3 years ago
How can you modify elements of the Start menu?
netineya [11]

Answer: you can add program by using a "pin" option or

For frequently used program you can customize the list by including or exuding program

But those on right are coming with Windows features

4 0
3 years ago
Define and explain the two different methods by which a file can be compressed. Briefly describe one pro and one con for both ty
Rina8888 [55]

Answer:

The answer to this question can be defined as follows:

Explanation:

In this question, the Lossy compression requires a data merging software program. The benefit would be that compared to lossless compressions, it can create smaller files. One aspect was that every piece of information is usually lost. It is used to analyze their digital information on a computer model, seeking a place to buy it in another form. The pre is also no loss of data. Another thing would be that sound files wouldn't fit properly.

4 0
3 years ago
A TextLineReader is an object that can read a text file one line at a time, parsing each line and turning it into an object of s
lesya692 [45]

no one is going to answer

4 0
3 years ago
You have four DCs in your domain. Active Directory appears to be corrupted on one of the DCs, and you suspect a failing hard dri
Softa [21]

Answer:C

Explanation:

5 0
3 years ago
Other questions:
  • Are there any Free programs that let's you use the GreenScrene? But, inside already made videos not while making the video.
    11·1 answer
  • Which statement is a good reason for backing up your data to the cloud?
    7·2 answers
  • ________ is a wireless protocol designed for transmitting data over short distances, replacing cables. ipv6 ipv4 paas bluetooth
    11·1 answer
  • This morning when Paul turned on his computer at work, it would not boot. Instead, Paul reported that he heard a loud clicking n
    12·1 answer
  • Write an expression that computes the integer average of the int variables exam1 and exam2 (both declared and assigned values).
    15·1 answer
  • Find the number of times a value appears in a list, and create a new list that contains the index positions where the value occu
    6·1 answer
  • How do mass and social media differ
    8·1 answer
  • Write a program that sorts an array of 20 random numbersin the range from 0 through 1000.
    6·1 answer
  • In relation to data science,advances in technology has made it more feasible to do what
    5·1 answer
  • John is directing a television series. He has to shoot a scene that presents the lead character in a dominating and commanding p
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!