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!");

Write Python version of solution so that N validation condition become.pdf

  • 1.
    Write Python versionof 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!");