Skip to content

yidilozdemir/PythonFunctionLibrary

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Function Library

The Python Basics Library is an agrigation of numerous Python functions that are ready to be integrated into any Python project. The functions range from basic to advanced and can be run in both a terminal and in accompanying HTML

contents:

  • Zig Zag
  • Call Stack Funciton
  • Collatz
  • Guess the Number
  • The Magic 8 Ball
  • Rock Paper Scissors
  • The Coin Flip
  • Conway
  • Tic Tac Toe

    • Zig Zag -

      The Zig Zag function makes use of a while True infinite loop and the time.sleep() function to slow down the rendering of our program in the terminal. Every tenth of a second the program prints again on a different line but with a ' ' before or after the text to give the illusion the text is "zigzagging" down the page like a snake.

      zigzag

      Call Stack Function - The Call Stack Function is how Python remembers where a function first started and then returns there after the function is complete. It is usually running behind the scenes but it is demonstrated here.
      callstack
      Collatz Sequence - The Collatz function takes one integer. If the integer is even then it is divided by 2, if it is odd, it is multiplied by 3 and adds 1. No one is sure why, but whatever integer is given the final result is always one.
      collatz
      Guess the Number - The program uses the random.randint() function by way of the random module to find the target number between the set number parameters. The user is then asked for an imput and the input is checked against the target number. The program then responds with either "too low," "too high," or "correct." Each input is traced and the player will lose if the input number exceeds 6.
      guessTheNumber
      The Magic 8 Ball - The program uses the random.randint() function by way of the random module to find the target number depending on the number of possible responses.
      magic8ball
      Rock Paper Scissors - the program first calls the random and sys modules to use random.ranint() and sys.exit(). Three variables are then established to keep track of our wins, loses, and draws. There are two while loops at play, the first loop runs the whole game, while the second takes inputs from the player. The inner loop then breaks and the random.randint() function chooses an integer assigned to rock, paper, or scissors. The user input and the random integer are then compared and the winner is declared.
      rps
      The Coin Flip -
      Coin Flip gif
      Conway -
      Conway gif
      Tic Tac Toe -
      Tic Tac Toe gif Tic Tac Toe gif

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%