All Questions
128 questions
6
votes
2
answers
723
views
Making a Rock Paper Scissors game in Python - How to reduce repetition and make it more effective?
I am a "new" coder to Python - saying this because I got stuck in the tutorial hell - and I saw that doing projects was a way of consolidating what I had learnt from those tutorials, so here ...
2
votes
3
answers
757
views
Find median value of two Sorted Arrays
To improve my coding knowledge can you please give me suggested changes on my code?
...
1
vote
1
answer
173
views
Determine the chance a streak of 6 HEADs or 6 TAILS appear in 100 flips, repeated 10000 times [closed]
Here's the problem from the book Automate the boring stuff:
write a program to find out how often a streak of six heads or a streak of six tails comes up in a randomly generated list of heads and ...
3
votes
3
answers
1k
views
Creating Phone Number challenge from Code Wars
I solved a question on Codewars about creating a phone number:
Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone ...
11
votes
4
answers
2k
views
Wordle puzzle game
I am a beginner programmer with not much experience, the little I do have is with Python specifically.
With all the fuss going around about the popular word game "Wordle" I wanted to ...
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 ...
2
votes
1
answer
1k
views
Find the closest match to a string [closed]
Input
The first line of input contains a string s: the word misspelled
by your partner. Assume that your partner did not add or remove any
letters; they only replaced letters with incorrect ones. The ...
1
vote
1
answer
371
views
Google Foobar challenge optimization
I am trying to solve Google Foobar challenge prepare-the-bunnies-escape using my own approach, instead of BFS. I attempt to solve two ends of the maze and try to ...
3
votes
2
answers
700
views
Python 3 approximate pi using 9 algorithms
Note: this script requires gmpy2, if you are using Python 3.9.5 x64 on Windows 10 21H1 like me, then you need to download the pre-built ...
6
votes
2
answers
1k
views
Python Place +,-, nothing between 1, 2, …, 9 (in this order) whose sum is 100
So this is a programming challenge I saw:
Write a program that outputs all possibilities to put + or - or nothing between the numbers 1,2,…,9 (in this order) such that the result is 100. For example ...
4
votes
3
answers
2k
views
Python random word generator that generates a wordlike pronounceable string
This is a random word generator I wrote in Python 3 today, I don't know how many Python implemetations of this exist, but this is my first try and it is completely working.
It returns a random word ...
3
votes
1
answer
549
views
Python script that converts Windows Registry Scripts (.reg) into PowerShell scripts (.ps1)
Well this a re-implementation of a PowerShell script that I wrote which does exactly the same thing, and I have ported it into Python.
After a quick Google search I found that there is only one other ...
3
votes
1
answer
1k
views
Python code to find greatest common divisor of multiple numbers
Hmm, I know this has been implemented countless times, and Python 3.9.5 math standard library has a built-in gcd() method that ...
4
votes
1
answer
1k
views
Google Foobar Level 1 - Minion Task Schedule
I recently just stumbled upon a post regarding Google Foobar Level 2 and decided to try it out myself but starting from Level 1. The description and code are shown below.
Write a function called <...
5
votes
2
answers
605
views
LeetCode 8: String to Integer (atoi)
I'm posting a solution for LeetCode's "String to Integer (atoi)". If you'd like to review, please do. Thank you!
Problem
Implement atoi which converts a string to an integer. The function ...