I am making a TikTok algorithm and here is the code it essentially takes the input of the user and determines what rank they are.
import random
share_count = int(input("How many shares did you get on your last tiktok "))
like_count = int(input("How many likes did you get on your last tiktok "))
comment_count = int(input("How many comments did you get on your last tiktok "))
posts = int(input("How many posts do you have on your tiktok page "))
def magic_algorithm(share_count, like_count, comment_count, posts):
if share_count >= 10000 and like_count > 5000 and comment_count > 200 and posts >25:
rank = 1
elif share_count >= 7000 and like_count > 2000 and comment_count > 60 and posts >25:
rank = random.randint(2,10)
elif share_count >= 6000 and like_count > 1500 and comment_count > 50 and posts >25:
rank = random.randint(11,20)
elif share_count >= 5000 and like_count > 1300 and comment_count > 33 and posts >20:
rank = random.randint(21,40)
elif share_count >= 4000 and like_count > 1000 and comment_count > 25 and posts >15:
rank = random.randint(41,55)
elif share_count >= 3000 and like_count > 500 and comment_count > 15 and posts >11:
rank = random.randint(56,70)
elif share_count >= 2000 and like_count > 300 and comment_count > 10 and posts >11:
rank = random.randint(71,80)
elif share_count >= 1000 and like_count > 150 and comment_count > 10 and posts >11:
rank = random.randint(81,90)
elif share_count >= 400 and like_count > 100 and comment_count > 5 and posts >11:
rank = random.randint(91,95)
else:
rank = random.randint(96,100)
return rank
print("you rank on the platform is " + magic_algorithm(share_count, like_count, comment_count, posts))
but for some reason, I'm encountering an error that states:
print("you rank on the platform is " + magic_algorithm(share_count, like_count, comment_count, posts))
TypeError: can only concatenate str (not "int") to str