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?

SAS Enterprise Guide – Date value syntax error

Advertisements Hope someone can help me in my case when in SAS EG. t1.MIN_of_DATE_PARAM – in date format t1.MAX_of_DATE_PARAM – in date format CASE WHEN t1.MIN_of_DATE_PARAM < 01JAN2019 AND t1.MAX_of_DATE_PARAM < 01JAN2019 THEN ‘OLD CLIENT’ END how can i compare it to jan12019 which I have declared in the calculation? here’s the error i get:… Read More SAS Enterprise Guide – Date value syntax error

Why is my calculation not working in Java?

Advertisements I tried debugging but the variable y remains as 0 instead of carrying out the expected calculation. Someone tell me what I’m doing wrong. Thank you. public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); System.out.println("Enter odd number: "); int n = Integer.valueOf(scan.nextLine()); scan.close(); double y =… Read More Why is my calculation not working in Java?