Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
がlikes variableありdislikes variableますが、評価を 0 から 5 に変更するにはどうすればよいですか?
likes variable
dislikes variable
例:
0 Likes - 0 Dislikes
1 Likes - 0 Dislikes
5 Likes - 5 Dislikes
どうもありがとう ...
5 * 好き / (好き + 嫌い)
UPD:書式を保持するためにコメントからここに追加:
if dislikes is 0: if likes is 0: 0 else: 5 else: 5 * likes / (likes + dislikes)