All Questions
95 questions
4
votes
3
answers
1k
views
Coding exercise to represent an integer as words using python
Context:
Convert a non-negative integer num to its English words representation.
Example 1:
Input: num = 123
Output: "One Hundred Twenty Three"
Example 2:
Input: num = 12345
Output: "...
2
votes
1
answer
662
views
Find all permutations of string using recursion
Background: I am somewhat new to programming and only two weeks into learning Python. Currently trying to improve my understanding of recursion, which has been a tough concept for me to implement.
...
0
votes
1
answer
187
views
Getting three numbers input interactively and process them
I'm new to Python and programming in general.
Let's imagine I have a simple task:
Given 3 numbers from user input, I need to count negative ones and print the result.
Considering what I know about ...
5
votes
3
answers
1k
views
Find all numbers that are factors of one array and factor into the second array, then print their count
I'm working on a solution to the Following problem on Hackerrank, and I seem to have found a function that works for the purpose.
However, I feel as though this is a very overdesigned solution to a ...
8
votes
4
answers
2k
views
Implementing Sieve of Eratosthenes faster
I wrote a version of Sieve of Eratosthenes:
...
12
votes
3
answers
3k
views
A simple encryption program using Python
I made this encryption program in Python.
I don't have much experience (or any experience at all) about encryption (since I just gave my 9th grade finals), but I had this idea about an algorithm some ...
5
votes
2
answers
675
views
DNA Challenge from CS50
Added the problem link below and my implementation of it. Took me a few hours to program. I have added comments to explain my thought process.
Problem Link
Goal - To implement a program that ...
14
votes
4
answers
3k
views
Shell Sort, Insertion Sort, Bubble Sort, Selection Sort Algorithms (Python)
There is a follow-up question available:
shell-sort-insertion-sort-bubble-sort-selection-sort-algorithms-python.
Selection Sort
The selection sort algorithm sorts a list (array) by finding the ...
5
votes
1
answer
5k
views
Find if one list is a subsequence of another
So the problem of verifying if a list is a subsequence of another came up in a discussion, and I wrote code that seems to work (I haven't rigorously tested it).
IsSubequence.py
...
1
vote
2
answers
108
views
Object-Oriented Blackjack V2
[Edited] formatting and Flake8 linter corrections
Four days ago I posted my first object oriented programming project.
Everything I have learned to date is self-taught and posting project to receive ...
10
votes
9
answers
3k
views
Beginner FizzBuzz in Python
This is my first attempt at solving Fizzbuzz. I've always been pretty weak at algorithms, so I'm trying to improve. Specific feedback on performance would be appreciated.
...
5
votes
3
answers
5k
views
Binary Tree Sort Algorithm (Python)
A Binary Tree Sort is an algorithm that builds a binary search tree from the elements to be sorted, and then traverses the tree (in-order) so that the elements come out in sorted order.
Average Case ...
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:
...
4
votes
4
answers
21k
views
Use Python to determine the repeating pattern in a string
I am writing an algorithm to count the number of times a substring repeats itself. The string is between 1-200 characters ranging from letters a-z. There should be no left overs at the end of the ...
14
votes
3
answers
7k
views
Maze solver and generator in Python
After watching Computerphile's video I decided to create my own maze solver and generator in Python. I've never written anything in Python so I'd like to get some feedback about my code, specifically ...