integer

Floating-point errors in cube root of exact cubic input

Floating-point errors in cube root of exact cubic input Question: I found myself needing to compute the "integer cube root", meaning the cube root of an integer, rounded down to the nearest integer. In Python, we could use the NumPy floating-point cbrt() function: import numpy as np def icbrt(x): return int(np.cbrt(x)) Though this works most …

Total answers: 1

How to convert a string to an integer class within a python function?

How to convert a string to an integer class within a python function? Question: In a python function, I have defined two variables as letters. def Vandermonde(x, d): x_0=-1 a = np.arange(d) I am getting the error that "d"is not defined in a = np.arange(d). I suspect, but could be wrong, that this is because …

Total answers: 1

Int's in input please help me

Reading ints in input in a Python program Question: I have to take input from the user then the operator has to print what number is before the input and after the input like: input= 3 has to print 2 and 4 I used range, did I do it wrong? I am just a beginner …

Total answers: 3

Dividing a 24-digit binary number to 3 equal parts

Dividing a 24-digit binary number to 3 equal parts Question: I’d like to know how can I divide a 24-digit binary number which is taken from user in python to 3 parts and then put different conditions on each of these 3 parts. e.g: input => 111100011110110100100100 divide the input to 3 equal parts (each …

Total answers: 1

leading zero causes an exception in the program

leading zero causes an exception in the program Question: i hope you are doing well. I have a question maybe it is stupid to ask rather than search. but I looked up for a satisfactory answer. Why leading zero is not allowed in some language, such as python. what problems can leading zero produce? thanks …

Total answers: 1

I am a helpless Python Beginner:(

How to get a day based on a number from 1 to 365 Question: I want to get a day based on a number from 1 to 365. An integer in the range of 1 to 365 is given and I need to find the day of the week for a given day in a …

Total answers: 4