Skip to content

Bag, wrong Python documentation 7.1. Fancier Output Formatting, with str.format() funnction example..  #124522

@user2710

Description

@user2710

Python documentation. Bag, mistake in exemple. Misleading exemple.

  1. Input and Output
    7.1. Fancier Output Formatting
    Wrong example in str.format() explanation.

https://docs.python.org/3/tutorial/inputoutput.html

The percentage calculate different way. Yours example not pass the numbers, Yes voices 50 and total voices 100. 50 voices is 50% from total 100 number voices. it is mean there some No voices maybe rest of 50 voices = 50 % from 100 voices. (maybe some vote No, some vote yes, and some people maybe vote: "we dont have opinion". There we don't have more information than we have, there only yes and total quantity/volume of voices)

to calculate percentage from number need use different formula. example: find how much number 84 is percentage from number 493, need to do: 84 × 100 ÷ 493 = 17.0385395538 % . the result number " 17.0385395538 " is percentage of number 84, from number 493. it mean 84 number is 17.0385395538 % from 493.
example 2 : we have 24 boxes in one package. 1 package is made from 300 boxes. 25 × 100 ÷ 300 = 8 %. 25 boxes are 8 % from 1 package made from 300 boxes. or to say 8 % from number 300 is 25.

x (part number) × 100 ÷ y (main number) = % percentage that filled number x from number y.


Bonus information.
Addition information explain how to get number from number when known the percentage. Example 1: we know number 493 and percentage 17.0385395538%, but we want to know how much is number part made this percentage. the formula is 493 × 17.0385395538 ÷ 100 = 84.

Example 2: 600 × 20 ÷ 100 = 120. 120 number is 20% from number 600. numbers example 2 just to show even number, integer or said 20 % from number 600 is 120.

I notice people dont know how to calculate percentages at all. they just divide two numbers. i saw it already many times. how you wrote applications especially for analytics if you calculate wrong ?!!!! yours formula find percentage is misleading. people teach others people wrong formula, guys not say or wrote percentage when you calculate thar formula you used, because there no percentage, you just found how many times one number made other number, and word percentage very misleading. even people from different professions calculate wrong percentage if there no button percentage in their calculator.

But yeap did check work of code. the format function works somehow i don't how. how they made right percentage without right formula.
but some people forget write format word.

Screenshot_2024-09-25-08-25-02-259_com android chrome

Documentation

(A clear and concise description of the issue.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions