subject

2.4 Code Practice: Question 2 Write a program that accepts a number as input, and prints just the decimal portion. Your program should also work if a negative number is inputted by the user.

Sample Run
Enter a number: 15.789
Sample Output
0.789
Hints:
You'll likely need to use both the int() and float() commands in your program.
Make sure that any number the user inputs is first stored as a float.
You'll need to use at least two variables in your program: one that stores the original value entered by the user, and one that represents the integer value entered by the user.
These two variables can be subtracted from one another, to leave just the decimal portion remaining.
Don't forget to have your program print the decimal portion at the end!

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:30, lauriepdx
The cm is responsible for overseeing the actions of the crisis management team and coordinating all crisis management efforts in cooperation with disaster recovery and/or business continuity planning, on an as-needed basis
Answers: 1
image
Computers and Technology, 23.06.2019 01:30, shelley3135
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, magicalunicorns47
Arecipients list has been loaded into a document. which commands should be clicked in order to filter the list so that letters will not be printed for recipients who live in a certain state? mailings tab, start mail merge, select recipients, type new list, then insert only contacts from the desired states mailings tab, rules, select recipients, use existing list, then choose a recipients list that includes only contacts in certain states mailings tab, select recipients, use existing list, rules, fill in, then type in certain states mailings tab, rules, skip record select “state” under field name, then type in the state name under “equal to”
Answers: 2
image
Computers and Technology, 24.06.2019 00:00, babysisjessica1
For the following example of making a peanut butter and jelly sandwich, identify which are inputs, processes, or outputs: bread scooping and spreading peanut butter plate scooping and spreading jelly finished sandwich putting two pieces of covered bread together dirty plate crumbs
Answers: 2
You know the right answer?
2.4 Code Practice: Question 2 Write a program that accepts a number as input, and prints just the d...

Questions in other subjects:

Konu
Mathematics, 11.09.2020 01:01
Konu
Mathematics, 11.09.2020 01:01
Konu
Mathematics, 11.09.2020 01:01
Konu
Mathematics, 11.09.2020 01:01
Konu
Mathematics, 11.09.2020 01:01
Konu
Mathematics, 11.09.2020 01:01
Konu
Mathematics, 11.09.2020 01:01
Konu
Mathematics, 11.09.2020 01:01
Konu
Physics, 11.09.2020 01:01
Konu
Mathematics, 11.09.2020 01:01