All Questions
17
questions
2
votes
1
answer
92
views
Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 2 of 3, CLI: Newspaper Bill ...
13
votes
5
answers
10k
views
Cleaning up date strings in Python
Working from a CSV of about 14.000 lines, I need to match dates in the CSV against some API. I'm reading the CSV using Pandas (for various other reasons). Most often, the date is just a year, i.e. an ...
9
votes
2
answers
180
views
Payments and liabilities
Get names from names.txt
Get transactions from transactions.txt
The output of the program should show who owes what like so:
...
8
votes
2
answers
12k
views
Finding the largest repeating substring
Here's my code that takes a large string, and searches for the longest reoccurring substring. It compares the first letter with every other until it finds a match, then saves it. Then it compares the ...
7
votes
2
answers
1k
views
Automate the Boring Stuff CH 7: password strength test
This exercise comes from Automate the Boring Stuff Ch 7. The assignment is to use regular expressions to test the strength of a password. Password must be >= 8 characters, contain at least one ...
6
votes
2
answers
339
views
Finite state automata
This is a non-deterministic finite state automata (NFA) meant to be used with a Regex engine. To show some example usage, suppose you wanted to construct an NFA for the regex ...
6
votes
1
answer
102
views
Inserting filename, reading data, inserting regex, and testing if each line matches
This program first displays a menu which shows some options that the user can select. Each option will the respective functions which do some things.
The user can insert a filename, read data from it,...
5
votes
3
answers
1k
views
LeetCode 65: Valid Number (Python)
Problem
Validate if a given string can be interpreted as a decimal or scientific number.
Some examples:
...
5
votes
2
answers
2k
views
Regex version of strip() - Ch. 7 Automate the Boring Stuff
Here is a practice exercise — Regex version of strip() \$-\$
Write a function that takes a string and does the same thing as the
...
4
votes
1
answer
545
views
Classification of Date/Time/DateTime
I'd like to share a methodology I've been using when faced with a classification
problem. This particular example is designed to classify time data as Date/Time/DateTime. Though I believe it could ...
3
votes
1
answer
68
views
Run an external program and extract a pattern match along with the result file
The script takes two input files of protein sequences and runs an external program (installed in linux/MacOS). The result provides a text output file example output.. Identity percentage is extracted ...
3
votes
1
answer
94
views
Inserting filename, reading data, inserting regex, and testing if each line matches - version 2
This is a improved version of the program seen in my older question.
This program first displays a menu which shows some options that the user can select. Each option will the respective functions ...
2
votes
1
answer
1k
views
Python - Password Generator & Strength Checker
I am a beginner in Python and I have attempted to create a small script/program which allows the user to do the following:
Generate a single random password
Generate a number of passwords specified ...
2
votes
2
answers
967
views
Speeding up and fixing phone numbers from CSVs with Regex
I've hodgepodged together an attempt to extract all phone numbers from all CSVs in a directory, regardless of where they are and what format they're in. I want all phone numbers to be printed to a ...
2
votes
1
answer
1k
views
TDD: String Calculator Kata
String Calculator
Create a simple String calculator with a method int Add(string numbers).
The method can take 0, 1 or 2 numbers, and will return ...
1
vote
1
answer
103
views
using pandas and numpy to parse dirty .csv
I'm relatively new to Python have been writing for a few months now. I've started a Pandas Numpy project that starts with parsing large and somewhat sloppy formatted textfile, its not exactly csv but ...
1
vote
1
answer
507
views
Coin Flip Streaks script
I am attempting to complete the coin flip streaks problem from automate the boring stuff with python.
My code works fine but my only concern is the phrasing of the task.
Does the question want us to ...