No products in the cart.

# Write a python program to calculate … ## CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Write a python program to calculate the average of first N odd numbers.

Pratishtha Shree 2 weeks, 3 days ago

Here's ur program in python: n=int(input("Enter the number")) i=0 num=1 sum=0 While i

Pratishtha Shree 2 weeks, 3 days ago

Here's ur program in python: n=int(input("Enter the number")) i=0 num=1 sum=0 While i

Abhinav Verma 2 months, 2 weeks ago

# Python from math import ceil, floor def odd_gte(num): """ Return the first odd value >= num """ num = ceil(num) k = num // 2 return 2*k + 1 def odd_lte(num): """ Return the first odd value <= num """ num = floor(num) k = (num + 1) // 2 return 2*k - 1 def odd_average(start, stop): """ Return the average of all odd numbers in the range Note: this follows standard Python range semantics, such that stop is not included in the range. """ first = odd_gte(start) last = odd_lte(stop - 1) return (first + last) / 2 print(odd_average(2, 101)) # 51.0

Related Questions ## myCBSEguide

Trusted by 1 Crore+ Students ## Test Generator

Create papers online. It's FREE. ## CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app