Skip to content

Instantly share code, notes, and snippets.

@Red-Satori
Created November 7, 2022 13:06
Show Gist options
  • Save Red-Satori/80589b8688b4ead598ad9015ab837732 to your computer and use it in GitHub Desktop.
Save Red-Satori/80589b8688b4ead598ad9015ab837732 to your computer and use it in GitHub Desktop.
Python Script to Calculate a Man's SMV
#!/usr/bin/python3
# -*- coding: utf-8 -*-
inputs = ['face', 'height', 'body', 'money', 'p-length', 'intelligence']
weights = [5, 3, 2, 2, 2, 1]
# Courtesy of Wheat Waffles
# https://www.youtube.com/watch?v=kZqNkkX7oeE
def calculate_smv():
"""Calculate your SMV based on different weighted factors"""
total = 0
for i, v in enumerate(inputs):
user_input = None
while (type(user_input) != float or user_input < 1 or user_input > 10):
user_input = input('\n\x1b[32m' + v.title() + ": \x1b[37m")
try:
user_input = float(user_input)
if user_input < 1 or user_input > 10:
print("Must be a number between 1 and 10")
else:
weight = weights[i]
print(f"weight: {weight}")
final_val = user_input ** weight
total = total * final_val if total > 0 else final_val
print(f"{v.title()} final: {final_val:,}")
except:
print("Must be a number between 1 and 10")
total_weight = sum(weights) # 15
final = total**(1/total_weight) # find root using total weights
print(f"\n\x1b[33mTotal:\x1b[37m {total:,}")
print(f"\x1b[33mFINAL SCORE:\x1b[37m {final}")
if __name__ == '__main__':
calculate_smv()
@Red-Satori
Copy link
Author

python-calculate-smv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment