Why does division "/" and floored division "//" operators in python gives different results for divisions with a remainder = 0?

When dividing somewhat large integers with numbers that divides them, I get different results from division / and floored division //. for instance: In [1]: a = 123456789012345678 In [2]: int(a/2) Out[2]: 61728394506172840 In [3]: a//2 Out[3]: 61728394506172839 clearly 2|a, and out[3] is the correct answer, so why the inconsistency from the division operator? what… Read More Why does division "/" and floored division "//" operators in python gives different results for divisions with a remainder = 0?

How to set a number of loop 'for' as a parameter of a function in python to find all the possibility to cut a period in n parts?

Here is a ugly code to find all the possibilities to cut a period in 5 parts. Is there a possibility to create a function which makes it look better, with the number of cut as a parameter ? I am only abble to write each for loop : part_list = pd.DataFrame(columns=[‘period_array’]) for i in… Read More How to set a number of loop 'for' as a parameter of a function in python to find all the possibility to cut a period in n parts?

How to make C accept if y==0

#include <stdio.h> int main() { int x,y,add,subtraction,multiplication,division; printf("Write x:"); scanf("%d",&x); printf("Write y:"); scanf("%d",&y); add = x+y; printf("Add=%d\n",add); subtraction = x-y; printf("subtraction = %d\n",subtraction); multiplication = x*y; printf("multiplication = %d\n",multiplication); division = x/y; if (y == 0) printf("Operation not permitted"); else printf("division = %d\n",division); return 0; } So When i’m printing y=0 nothing happens No "Operation… Read More How to make C accept if y==0