Giter Club home page Giter Club logo

python-basics's Introduction

python-basics

This repository contains easy examples and tips for python coding.

Files:
General

  • Arithmetic operators: Present arithmetic operators (000-arithmetic_operators.py)
  • Comments: Present commenting methods (000-comments.py)
  • Datatypes: Demonstration of different data types in Python (000-datatypes.py)
  • Inheritence: A class (child class or derived class) inherits properties, methods and functions from another class (parent class or base class). (000-inheritence.py)

Functions

  • abs: Get the absolute value of a number (007-abs.py)
  • all: Return True if all elements in iterable are true (021-all.py)
  • any: Return True if any elements in iterable are true (022-any.py)
  • bin: Return the binary version of any integer (019-bin.py)
  • bool: Return the boolean value of an object (018-bool.py)
  • capitalize: Return capitalized version of a string (047-capitalize.py)
  • count: Counting elements in a collection with a specific value (049-count.py)
  • del: Delete variable or user-defined object (040-del.py)
  • divmod: Get quotient and remainder of two non-complex numbers (051-divmod.py)
  • enumerate: Convert collections into an enumerate object (006-enumerate.py)
  • fabs: [math] Get the absolute value of a number (030-fabs.py)
  • find: Search for a specific character in a string (050-find.py)
  • fmean: [statistics][python=3.8] Get the arithmetic mean of numbers (035-fmean.py)
  • for: Iterate over a sequence. Sequence can be range, list, tuple, dictionary, set or string (004-forloop.py)
  • geometric_mean:[statistics][python=3.8] Get the geometric mean of numbers (0036-geometric_mean.py)
  • harmonic_mean: [statistics] Get the harmonic mean of numbers (033-harmonic_mean.py)
  • hex: Return the hexadecimal version of any integer (024-hex.py)
  • input: Get input from user via console or command line (003-input.py)
  • len: Get the number of items in an object (015-len.py)
  • lower: Return lowercase version of a string (044-lower.py)
  • lstrip: Remove any character(s) from the beginning of a string (028-lstrip.py)
  • max: Get the highest value from an iterable (014-max.py)
  • mean: [statistics] Get the arithmetic mean of numbers (032-mean.py)
  • median: [statistics] Calculate median of numbers (034-median.py)
  • median_high: [statistics] Calculate median of numbers (038-median_high.py)
  • median_low: [statistics] Calculate median of numbers (037-median_low.py)
  • min: Get the lowest value from an iterable (013-min.py)
  • next: Return the next item in an iterator (023-next.py)
  • oct: Return the octal value of any integer (055-oct.py)
  • perm: [math][python=3.8] Number of possibilities to choose k items from n items without repetition with order (048-perm.py)
  • pickle: Object serialization: save and load objects into a pickle file (009-pickle.py)
  • platform: [platform] Get platform data (041-platform.py)
  • print: Print something onto the screen. The screen does mean console, terminal or command line (002-print.py)
  • pop: Remove item from a list (011-pop.py)
  • pow: Get the value of number to the power of another number (020-pow.py)
  • reverse: Get a reverse of list (012-reverse.py)
  • round: Round a number (010-round.py)
  • rstrip: Remove any character(s) from the end of a string (027-rstrip.py)
  • slice: Return a slice object (056-slice.py)
  • sorted: Get a sorted list of any iterable object (017-sorted.py)
  • split: Split a string into a list by a specific separator (025-split.py)
  • sqrt: [math] Get the square root of a number (031-sqrt.py)
  • strip: Remove any character(s) from the beginning and ending of a string (029-strip.py)
  • sum: Return the sum of iterable and start value (016-sum.py)
  • super: Inherit all methods and properties from another class (059-super.py)
  • swapcase: Swap cases in a string (046-swapcase.py)
  • sys_platform: [sys] Check operation system (042-sys_platform.py)
  • time: Return current timestamp in seconds (039-time.py)
  • tqdm: Progress bar into the console with tqdm (008-tqdm.py)
  • try: Test part of a code (043-try.py)
  • type: Return type of a specified object (057-type.py)
  • upper: Return uppercase version of a string (045-upper.py)
  • vars: Return the __dic__ attribute of an object (058-vars.py)
  • while: Looping as long as a condition is True (005-whileloop.py)

Short programs

  • 2^n in O(1) Calculate 2^n in O(1) (053-2n_in_O1.py)
  • break_continue: How to speed up for cycle with break and continue (060-break_continue.py)
  • Comparsion lists: Comparsion two lists and get back common elements (026-comparsionlists.py)
  • Hello, World!: A classic "Hello, World!" application in 8 different ways (001-helloworld.py)
  • Pass: Use null statement as placeholder for future implementation (061-pass.py)
  • Sum of first 2^n: Sum of the first n powers of 2 fast (054-sum_first_n_2n_fast.py)
  • Swap variables: Swap variables (062-swap_variables.py)
  • Try import: Show example how to handle missing import (052-try_import.py)

Future

  • copy

python-basics's People

Contributors

richardvecsey avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.