if statement that sees if there is any value in a variable

The value of your variable must be a string in this case:

var1 = '2333'

if '4' in var1: 
    print('found it') 
else:
    newVariable = var1 + '4'
    print(newVariable)

Leave a Comment