Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Raj has n pens. If Raj keeps percentage p of the pens, the remaining will be shared among his friends. Write a Python program to

Raj has n pens. If Raj keeps percentage p of the pens, the remaining will be shared among his friends. Write a Python program to read the total number of pens, say it n.

Also read the percentage (p) of pens that Raj will keep with him.

Create a function[named share_YourRegistrationNumber] to Calculate the number of remaining pens (r) that will be shared among his friends. 
If no pen is left for sharing display No pens left to share. 
If percentage of pens fractional part is >=0.5 then raise the value to its higher integer and if it is <0.5 then lower the value to its lower integer. Input: First line contains the value of n Second line contains the value of p Output: The value of remaining pens(r) Constraints: 0p100 Otherwise print Percentage should be 0 to 100 n>=0 Otherwise print Pens should be >= 0 

For example:

Test Input Result
1
30 14
26

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago