Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CodeAlpha_PythonTask

Python Programming Project

CodeAlpha Python Programming Internship Projects

This repository contains my Python programming projects completed as part of the CodeAlpha Python Programming Internship.

The projects focus on building practical console-based applications while strengthening my understanding of Python fundamentals such as functions, loops, conditions, lists, dictionaries, user input, file handling, and the random and csv modules.


Projects Included

Task 1: Hangman Game

A simple text-based word guessing game where the player tries to guess a randomly selected word one letter at a time.

How It Works

  • The game randomly selects a word from a predefined list.
  • The hidden word is displayed using underscores.
  • The player guesses one letter at a time.
  • Correct guesses reveal the letters in the word.
  • Incorrect guesses increase the number of wrong attempts.
  • The player is allowed a maximum of 6 incorrect guesses.
  • The game ends when the player guesses the word or runs out of attempts.
  • Players can choose to play multiple rounds.

Concepts Used

  • random module
  • Functions
  • Lists
  • Strings
  • while loops
  • if-else statements
  • Input validation
  • User interaction

Example Words

python
hangman
developer
internship
programming

Task 2: Stock Portfolio Tracker

A console-based application that allows users to enter the stocks they own and calculate the total value of their portfolio based on predefined stock prices.

How It Works

  1. The program displays a list of available stocks and their prices.

  2. The user enters stock symbols and the quantities they own.

  3. The program calculates the value of each stock.

  4. The total portfolio investment is calculated.

  5. A summary of the portfolio is displayed.

  6. The user can save the results as either:

    • A .txt file
    • A .csv file

Available Stocks

Stock Price
AAPL $180
TSLA $250
GOOGL $140
AMZN $175
MSFT $420
META $480

Concepts Used

  • Dictionaries
  • Functions
  • Loops
  • Conditional statements
  • Input validation
  • Exception handling
  • File handling
  • CSV file writing
  • Basic calculations

Technologies Used

  • Python 3
  • Python Standard Library
  • random module
  • csv module

No external libraries are required to run these projects.


How to Run the Projects

1. Install Python

Make sure Python 3 is installed on your computer.

Check your Python version:

python --version

2. Clone or Download the Repository

Download the project files to your computer.

3. Run the Hangman Game

python hangman.py

4. Run the Stock Portfolio Tracker

python stock_portfolio.py

The filenames may be different depending on how the files are saved.


Suggested Project Structure

CodeAlpha-Python-Internship/
│
├── Task-1-Hangman/
│   └── hangman.py
│
├── Task-2-Stock-Portfolio/
│   └── stock_portfolio.py
│
└── README.md

Future Improvements

Hangman Game

  • Add difficulty levels
  • Add more words
  • Add hints
  • Add categories
  • Create a graphical user interface
  • Add score tracking

Stock Portfolio Tracker

  • Add more stocks
  • Use live stock prices through an API
  • Add support for multiple portfolios
  • Add profit and loss tracking
  • Create charts and graphs
  • Build a graphical user interface

Learning Outcomes

Through these projects, I practiced turning basic Python concepts into functional applications.

These projects helped me improve my understanding of:

  • Writing and organizing functions
  • Working with lists and dictionaries
  • Using loops and conditions
  • Validating user input
  • Handling errors with try-except
  • Working with files
  • Saving data in CSV format
  • Building interactive command-line programs

Internship Information

Program: CodeAlpha Python Programming Internship Tasks:

  • Task 1: Hangman Game
  • Task 2: Stock Portfolio Tracker

Programming Language: Python

These projects represent my progress in learning Python programming and applying fundamental programming concepts to practical projects.

About

Two Python projects completed during my CodeAlpha Python Programming Internship: a text-based Hangman Game and a Stock Portfolio Tracker. These projects demonstrate Python fundamentals including functions, loops, conditions, lists, dictionaries, input validation, exception handling, randomization, file handling, and CSV writing.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages