2
The number of Likes is cumulative, that is, if the post has 0 Likes and receives 5 Likes, it will have 0 + 5 =5 Likes. If soon, this same post receives 7 Likes, will have 5 + 7 = 12 Likes.
- If the original posting receives between 1 and 10 Ikes, then your neighbors receive 1 like bonus.
- If the original posting receives more than 10 Ikes, then your neighbors receive half of Ikes received by the original post.
- Error when assigning Likes. If by mistake there is an attempt to assign Likes to a not existing posting, in addition to showing an error message (not existing posting), these Ikes should be assigned to a random posting, without benefiting (deliver bonus) to the neighbors of that post.
I have already been able to assign Ikes to the original publication, but not to their neighbor
My code so far:
postagem = [5, 6, 9]
print('2) Dar likes a um post')
alternativa = int(input())
if(alternativa == 2):
qtd_like = int(input())
post = int(input())
if(qtd_like >= 1) and (qtd_like <= 10):
postagem[post] = postagem[post] + qtd_like
if(qtd_like > 10):
postagem[post] = postagem[post] + qtd_like