Printing text based on divisibility of number The following piece of code will print a text based on the divisibility of number.
If the number is not divisible by 3, 5 and 7, then the number gets printed.

Does making use of a f-string make the type cast of integers to string implicit?

def convert(number):
    result = ""
    if (number % 3 == 0):
        result += "Pling"
    if (number % 5 == 0):
        result += "Plang"
    if (number % 7 == 0):
        result += "Plong"
    if(number % 7 != 0 and number % 5 != 0 and number%3 != 0):
        result = f{'number'}
    return result
In programming, there are only three useful numbers, 0, 1, and many.

If you write an if-condition that repeats all the tests already done, you're doing something wrong.

If you write similar ad hoc code for three special cases, you're doing something wrong.

E.g. adding "11 Plung" will require two more lines for the special case and the "no match" case will have to be made even longer and uglier.

Write simple code for a general case, and then supply specific data as needed:

def convert(number):
    names = [ [3, "Pling"], [5, "Plang"], [7, "Plong"] ]
    result = ""
    for value,message in names:
        if not number % value: result += message
    if message == "": message = f"{number}"
    return result

for index in range(1,25): print(index, convert(index))


That way, if you later need to add the "11" case, it's a simple change, and more importantly it happens in only one place.