Skip to content

rpural/Code-Samples

Repository files navigation

Code-Samples

Samples coded from various problem sources

  • EquationParse.py - A simple equation parser, supporting +, -, *, and /, plus(). Does not use eval()
  • PwdChk.py - Menu with three functions, exit, read a file and check passwords, and generate a new password. Users-Pswds.py - input file containing users and passwords. Data file for PwdChk.py
  • Sock-pairs.py - Finds reversed pairs in a list, plus unpaired values. Pairings look like [ 'lv', 'vl' ]
  • acreSort.py - given a list containing names, lengths, and widths, sort by the size in acres.
  • banking.py - OOP example implementing a Bank and Accounts.
  • baseconvert.py - functions to convert between any base between 2 and 60. I just got tired of people asking how to convert to binary / octal / hexidecimal.
  • collatz.py - generate a number sequence from any starting value that always ends with 1.
  • kaprekar.py - given a 4 digit number, apply a repeating method which always ends with the value 6174.
  • literarySort.py - sort by name length and alphabetically, but always shifting a certain name to the top.
  • mixedList.py - given a mixed list of floats, ints, and strings, sum all the ints and all the sorts, including the strings if they contain an int or a float.
  • number2text.py - convert an int number to text (i.e. 32 becomes Thirty Two). Works through the trillions.
  • reverseNumber.py - given a list of values, print the numbers in reverse, with each digit doubled. (426 ->(reverse) 624 -> (double) 1248)

About

Samples coded from various problem sources

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages