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
ch4aika [34]
3 years ago
13

Write a program that takes a decimal number from the user and then prints the integer part and the decimal part separately. For

example, if the user enters 2.718, the program prints: Integer part = 2 and decimal part = .718 in python
Computers and Technology
1 answer:
svp [43]3 years ago
7 0

Answer:

Explanation:

The following was coded in Python as requested. It is a function that takes in a number as a parameter. It then uses the Python built-in math class as well as the modf() method to split the whole number and the decimal, these are saved in two variables called frac and whole. These variables are printed at the end of the program. The program has been tested and the output can be seen below.

import math

def seperateInt(number):

   frac, whole = math.modf(number)

   print("Whole number: " + str(math.floor(whole)))

   print("Decimals number: " + str(frac))

You might be interested in
Write a program that prompts the user to enter: The cost of renting one room The number of rooms booked The number of days the r
Shtirlitz [24]

Answer:

Written in Python

cost = float(input("Cost of one room: "))

numrooms = int(input("Number of rooms: "))

days = int(input("Number of days: "))

salestax = float(input("Sales tax (%): "))

print("Cost of one room: "+str(cost))

print("Discount: 0%")

print("Number of rooms: "+str(numrooms))

print("Number of days: "+str(days))

totalcost = numrooms * cost

print("Total cost: "+str(totalcost))

salestax = salestax * totalcost/100

print("Sales tax: "+str(salestax))

print("Total Billing: "+str(salestax + totalcost))

Explanation:

The next four lines prompts user for inputs as stated in the question

<em>cost = float(input("Cost of one room: "))</em>

<em>numrooms = int(input("Number of rooms: "))</em>

<em>days = int(input("Number of days: "))</em>

<em>salestax = float(input("Sales tax (%): "))</em>

<em />

The following line prints cost of a room

print("Cost of one room: "+str(cost))

The following line prints the discount on each room (No information about discount; So, we assume it is 0%)

print("Discount: 0%")

The following line prints number of rooms

print("Number of rooms: "+str(numrooms))

The following line prints number of days

print("Number of days: "+str(days))

The following line calculates total cost of rooms

totalcost = numrooms * cost

The following line prints total cost

print("Total cost: "+str(totalcost))

The following line calculates sales tax

salestax = salestax * totalcost/100

The following line prints sales tax

print("Sales tax: "+str(salestax))

The following line calculates and prints total billings

print("Total Billing: "+str(salestax + totalcost))

6 0
3 years ago
Somebody supplied me with a file that was edited on a Windows machine. The file contains carriage returns in addition to the new
maria [59]

Answer:

It is  tr.

Explanation:

For removing all the carriage returns you can make use tr like

tr '\r\n' ' '

However, you cannot make use of the diff which finds the difference between the two files.

Onl is definitely not an option and cut holds different meaning that we know, Hence the above answer, tr can definitely help as shown above,

3 0
3 years ago
Traffic shaping reduces traffic by ________. preventing certain undesirable traffic from entering the network limiting the amoun
Lera25 [3.4K]

Answer:

Explanation:

Traffic Shaping is a technique for managing congestion on a network by delaying the flow of less important/desired packets on the network so more valuable/desirables ones are able to pass. Traffic shaping reduces traffic by preventing certain undesirable traffic from entering the network as well as limiting the amount of certain undesirable traffic entering the network.

5 0
3 years ago
How might you use PowerPoint as a student, as an employee, or personally?
katen-ka-za [31]

Answer: You can use a powerpoint as student for assignments, as an employee for presentations, and personally for taking notes.

Explanation:

7 0
3 years ago
Read 2 more answers
__________ ensure that hardware and software produced by different vendors work together.
inna [77]
Hi!

Standards are what help ensure that hardware and software made by different vendors can work together.

Hopefully, this helps! =)
4 0
3 years ago
Other questions:
  • Look at the following array definition:
    11·1 answer
  • 1.What is a project methodology?
    9·1 answer
  • Give an example of Digital Convergence.
    5·1 answer
  • All of the following are recommended to secure a wireless network EXCEPT:
    5·2 answers
  • 3k means about 3 thousand bytes. how would you express two hundred million bytes? .
    8·1 answer
  • How many frames per second can a half duplex traditional gigabit ethernet handle?
    12·1 answer
  • There are many opportunities for unscrupulous people to break information system security. Of the five components in an informat
    6·2 answers
  • What is the purpose of citations?
    13·1 answer
  • A programmer writing code in class Point attempts to override the following inherited method:public boolean equals( Object o ) {
    12·1 answer
  • Give 5 characteristics of bad capacitor<br> give 5 characteristics of good capacitor
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!