12,064,822 members (40,000 online)

Email

Password

Sign in using

I need a solution in python of this

y = 4/1-4/3+4/5-4/7+4/9-4/11...

Not using the If statement

just for loop

y = 4/1-4/3+4/5-4/7+4/9-4/11...

Not using the If statement

just for loop

Diar Selimi144

Comments

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada
+1 416-849-8900 x 100

Do you know that this "expression" (with ... at the end, aha :-) does not explain it completely, leaves a room for guess.

--SA

Anyway, it looks like a home assignment. It is apparently very, very trivial, but you should do your home assignments by yourself, we won't do it for you.

--SA

--SA

Now, about + and -. Now you are moving in right direction. The denominator is some -N or +N, depending on N. You can check if it's odd and write "if", but you are required to use only arithmetic operators, right? And what, do you think there is no arithmetic operators to give - or + in different cases? If not operator, it could be an expression using more then one operator, right? So, now the school arithmetic stuff comes into play... what can it be?

--SA

--SA