Tina-muriu / Python_Functions_Demonstration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description:

Welcome to the Python_Functions_Demonstration repository! This repository showcases a variety of Python functions covering arithmetic operations, list manipulation, conditional statements, and more. Each function is designed to demonstrate different aspects of Python programming, making it an excellent resource for learning and reference.

Included Functions:

  1. Arithmetic Operations:

    • Addition, subtraction, multiplication, and division functions.
  2. List Manipulation:

    • Functions for calculating length, finding the maximum element, and generating lists.
  3. Conditional Statements:

    • Functions demonstrating conditional statements, including positive/negative number identification and capital letter detection.
  4. Dictionary Creation:

    • A function illustrating the creation of a dictionary representation.
  5. Calculator Function:

    • A calculator function that can perform basic arithmetic operations based on user input.

README.md:

# Python_Functions_Demonstration

## Overview:

This repository serves as a comprehensive demonstration of Python functions covering various aspects of programming. Whether you're a beginner looking to understand basic concepts or a developer seeking examples for reference, these functions offer a practical and educational resource.

## Included Functions:

1. **Arithmetic Operations:**
   - `add(a, b)`: Addition of two numbers.
   - `sub(a, b)`: Subtraction of one number from another.
   - `mul(a, b)`: Multiplication of two numbers.
   - `div(a, b)`: Division of one number by another (handles division by zero).

2. **List Manipulation:**
   - `length(some_list)`: Calculates and prints the length of a list.
   - `find_max_in_list(some_list)`: Finds and returns the maximum element in a list.
   - `generate_list(name, num_elements)`: Generates a list with repeated elements.

3. **Conditional Statements:**
   - `positive_or_negative(num)`: Identifies if a number is positive, negative, or zero.
   - `positive_neg_forgottenreturn(num)`: A version of the previous function with a forgotten return statement.
   - `find_fcapital_letters(some_string)`: Finds the first capital letter in a string.

4. **Dictionary Creation:**
   - `create_dictionary_representation(name, age, occupation)`: Creates a dictionary representation with personal information.

5. **Calculator Function:**
   - `calculate(a, b, operator)`: A calculator function that performs basic arithmetic operations based on user input.

## Usage:

Feel free to explore each function to understand different programming concepts. Examples and explanations are provided within the code. Use this repository as a learning tool and reference guide for Python functions.

## Getting Started:

Clone this repository to your local machine to access the Python scripts. Each script is well-commented for easy comprehension.

## Contributions:

If you have suggestions or improvements, feel free to open an issue or submit a pull request. Your contributions are welcome!

Happy coding by Wwangui!

About


Languages

Language:Jupyter Notebook 100.0%