This repository contains tasks completed as part of my Code Alpha internship.
The projects showcase practical problem-solving using Python, with applications in games and finance.
A console-based word guessing game where the player has limited attempts to guess a randomly chosen word.
Features
- Random word selection from a list (
python,code,alpha,intern,project) - Tracks previously guessed letters
- Maximum of 6 incorrect attempts before game over
- Displays current progress after each guess
- Win/lose messages with fun emojis ๐ฎ
Sample Run ๐ฎ Welcome to Hangman!
Guess a letter: o โ Wrong guess. Attempts left: 5
Guess a letter: p โ Correct guess! p _ _ _ _ _
... ๐ Congratulations! You guessed the word: python
๐ View Code
A simple finance utility program to track investments in stocks using hardcoded stock prices.
Features
- Add stocks to a portfolio (AAPL, TSLA, GOOGL, AMZN, MSFT)
- Enter quantities for each stock
- Calculates portfolio value and total investment
- Option to save results into a
portfolio.txtfile
Sample Run ๐ Welcome to the Stock Portfolio Tracker! Enter stock symbol (or 'done' to finish): AAPL Enter quantity for AAPL: 10 Enter stock symbol (or 'done' to finish): MSFT Enter quantity for MSFT: 5 Enter stock symbol (or 'done' to finish): done
๐ Portfolio Summary: AAPL: 10 x $180 = $1800 MSFT: 5 x $300 = $1500
๐ฐ Total Investment: $3300 Save to file? (yes/no): yes ๐ Saved to 'portfolio.txt'
๐ View Code
- Python 3
- Built-in libraries:
random(for word selection in Hangman)- File handling (for portfolio saving)
- Concepts applied:
- Loops & conditionals
- Lists and dictionaries
- User input handling
- File I/O
- Clone this repository:
git clone https://github.com/Sumamasonia/code-alpha-tasks.git
2.Navigate to the folder: cd code-alpha-tasks
3.Run a project: python hangman_game.py or python stock_portfolio_tracker.py