Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to add a sentence before the the number/int PYTHON

Here’s the code i did:

list = input("Enter the number: ")

p = print("Trailing zeroes = ")

print(p, list.count("0"))

Output:

Enter the number: 10000

Trailing zeroes = 

None 4

The output i wanted:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Enter the number: 10000

Trailing zeroes = 4

>Solution :

Taking into account @OldBill ‘s comment:
This code do not count the trailing zero but rather the total amount of zeroes. I’m not deleting the answer as it offers a solution to OP’s main problem, as stated in the question

With

list = input("Enter the number: ")

p = print("Trailing zeroes = ")

print(p, list.count("0"))

What you do is p = print("Trailing zeroes = ") which is not a value.

either you should have

list = input("Enter the number: ")

p = "Trailing zeroes = "

print(p, list.count("0"))

or

list = input("Enter the number: ")

print("Trailing zeroes = ",list.count("0"))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading