I have a confusion on some code of python. Both code give me same answer

Advertisements I have been practicing Python on CodeChef I come up with the solution but some how it gave me error of Time Limit Exceeded. other code that gives same answer works fine which was submitted by other codechef members. My question is whats the difference between these two solutions. My Code t = int(input())… Read More I have a confusion on some code of python. Both code give me same answer

R using lubridate subtract 6 months but the dates dose not exist?

Advertisements I want to subtract 6 months from a date but using lubridate I get some NA’s. Here are my attempts: > as.Date("2013-12-31") – months(6) [1] NA > as.Date("2013-12-30") – months(6) [1] "2013-06-30" > as.Date("2014-01-01") – months(6) [1] "2013-07-01" > as.Date("2012-12-31") – months(6) [1] NA > as.Date("2014-12-31") – months(6) [1] NA > is it because… Read More R using lubridate subtract 6 months but the dates dose not exist?

An interest calculation task I'm working on doesn't output the proper results

Advertisements So I’m currently taking a C# fundamentals course as the entrance stage of a 6 month C# learning program. One of the tasks we have under the "Data Types and Variables" is an interest calculator. The premise is such: You have a "deposit" that you write in the first line. The deposit has a… Read More An interest calculation task I'm working on doesn't output the proper results

How to calculate my encoding sha256 maximum int lenght?

Advertisements I use this little code in a function to generate immutable hash of strings and store it. My problem is i don’t know how to find the max possible value with sha256 :7 ‘little’ ??? int.from_bytes(hashlib.sha256(value.encode(‘utf-8’)).digest()[:7], ‘little’) >Solution : Well, if you have seven bytes, and you turn that into an integer, the maximum… Read More How to calculate my encoding sha256 maximum int lenght?