Question: Write Python version of solution so that N validation condition become at the beginning of code (after user insert invalid code) int N; Console.Write(Enter N
Write Python version of solution so that N validation condition become at the beginning of code (after user insert invalid code)
int N;
Console.Write("Enter N (> 0): ");
if (int.TryParse(Console.ReadLine(), out N) && N > 0)
{
double Sum = 0.0;
for (int k = 1; k <= N; k++)
{
Sum += Math.Pow(Math.Log(k*100.0), 2.0);
}
Console.WriteLine(String.Format("{0}", Sum));
}
else
Console.WriteLine("Not a numeric value greater than 0!");
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
