umagba alex
umagba alex

Reputation: 85

How to convert numeric values to percentage

 A = 860
 B = 123
 C = (B/A) * 100
 Print("the proportion of C", round(C, 2), "%") 

TypeError: Invalid argument, not a string or column

Output The proportion of C is 14.3%

Upvotes: 1

Views: 251

Answers (3)

Majed Jaber
Majed Jaber

Reputation: 195

it seems you have a problem with print function just take a look this works for me

A = 860
B = 123
C = (B/A) * 100
print("the proportion of C", round(C, 2), "%")

Upvotes: 1

Ignace Vau
Ignace Vau

Reputation: 541

Your syntax seems correct except for a syntax error Print instead of print. You should either use print or fix your own Print function.

Upvotes: 1

Qasem Talaee
Qasem Talaee

Reputation: 37

This is the general formula for getting a percentage.

((final value - start value)/(final value))*100

and for print it, you must change it to string

print(str(round(C, 2))

Upvotes: 1

Related Questions