Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Comments
Sergey Alexandrovich Kryukov 30-Oct-12 18:39pm    
Well, if you need it, why not doing it? But first, can you strictly formulate the problem?
Do you know that this "expression" (with ... at the end, aha :-) does not explain it completely, leaves a room for guess.
--SA
Sergey Alexandrovich Kryukov 30-Oct-12 18:42pm    
And, by the way, why would you think this would require "if" in first place? :-)
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
Diar Selimi 30-Oct-12 18:53pm    
Well im a begginer in Programming and im not good in math ,so im trying to understand from the others how they do it . but thnx anyway , i will try by my self first then i will ask you for more
Sergey Alexandrovich Kryukov 30-Oct-12 19:08pm    
Well, then please do it first. By the time you come back, devise comprehensive and formal description of the mathematical problem. You don't want infinite number of iterations, right? After all, what's the problem? This is just a loop...
--SA
Diar Selimi 30-Oct-12 19:20pm    
yeahh it's just a loop but it has to be the operator first - than + than the denominator should always be an odd , and it's not a infinite number is based on what is the input .

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900