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 can i add text to a number inside a string

def sorter (*arguments):

big_numbers = []
small_numbers = []

for n in argument:
    if n**5 >100000:
        big_numbers.append (n**5) 
    else:
        small_numbers.append(n**5)



print (f 'big numbers: {big_numbers} \n small numbers: {small_numbers}')

sorter(8,2,66,45,3,7,9)

i want to add to each number the function prints to add text such as :’ is too big’ so the output will be something like :
[10000 is too big, 400000 is too big]
thank you

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

>Solution :

Try replacing this with your append this:

big_numbers.append (f'{n**5} is too big') 
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