I just submitted a solution for a leetcode problem, displayed below.
My solution is broken into three separate functions as shown below.
def Checker(dig, number):
"""
Purpose: Function check if the given number is divisible by each
digit in the given number.
Parameters...
First thank for the input, I can't believe I didn't think of using a slice method, thank you. To be honest I am just doing the leetcode problems, not for interview practice but more to learn about the python language itself. Also yes I agree my variable names should be more descriptive make...
Ah okay, I can see now thank you. Also, I am not aiming at splitting the given string. Basically I have to use a dictionary to convert there given string to a bunch of letter i.e decrypt the message, in this case, a-i is given the numbers 1-9 and j-z onwards is given by 10#, 11#,12#, etc.
I...
I am currently doing a leet code problem and came across something, I have not noticed before.
Here is a sample of the code I am working on.
s = "10#11#12"
A=[]
B=[]
i=0
count=0
while i < len(s):
if i+2<len(s) and s[i+2]=='#':
A+=[(s[i]+s[i+1]+s[i+2])]
i+=3
print(i)...
I didn't at the time it was about transient motion, but after reading your comment I did a little bit more research and came across the Unsteady Bernoulli Equation which has to do with transient motion, I am not sure if this will result in the given equation that I posted above but it does seem...
I was not really sure as to whether to ask this question here or the h/w forum as its something I am personally trying to understand. However, I shall let the admin decided.
The question comes from a book called :
. The specific question I have an issue with is not the question itself but the...
I did check the Data.gov site but didn't really find anything that I was looking specifically, but the UC database is very interesting. Thank for the link.
I am currently looking to improve my python skills and looking for some projects to do, one which came to mind was experimentally modeling in python. What I like to do is code an experiment say period of a pendulum and then compare the model to some data obtained in the lab, issue is I don't...
Recently I have been reading up about the logical operations OR, AND and XOR. Whilst reading about XOR I cam across a method using XOR to find the missing number in a given array, but I just can't understand how or really why it works. The algorithm is displayed below.
A = [2, 3, 1, 4, 6, 7]...
The clue in this question is that you know that the second marbel is white. Imagine that when you pick the first marble, which you don't know and place in a black box, then second marble you pick is white. So now you are left with a marble in the urn and a marble in the black box. What is the...
The index slice is being used to read the year and month and day from the string as u mentioned. I am now slightly confused to how my slicing produces the desired result for the year as you are right the index [0:3] should read the first four characters of the string '2018' however when I run...
Okay if my indexing is wrong then my algorithm is indeed incorrect, because with the indexing I was using I was getting the correct day, back the drawing board.
I got the algorithm from
https://en.wikipedia.org/wiki/Zeller%27s_congruence
Sorry I spelt it wrong I ment Zeller, my apologies