Skip to content

Instantly share code, notes, and snippets.

@Adobe-Android
Last active May 13, 2024 22:52
Show Gist options
  • Save Adobe-Android/8c3e7c844df061d23d6513ab27a7080d to your computer and use it in GitHub Desktop.
Save Adobe-Android/8c3e7c844df061d23d6513ab27a7080d to your computer and use it in GitHub Desktop.
Calculate the number of shares you can buy when providing share price and dollars to invest
#!/bin/env python3
def main():
share_price = 16.50
investable_dollars = 825
share_count = 0
share_count = investable_dollars / share_price
print(f"At a share price of ${share_price} and an investment of {investable_dollars}, you can purchase {share_count} shares")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment