Challenge 1: Yield Odd Numbers From 1 to n

Practice your concepts of generators by solving the exercise below.

Problem Statement

Create a generator to yield all the odd numbers from 1 to n.

Input

A number n

Output

All odd numbers from 1 uptil n

Sample Input

8

Sample Output

1, 3, 5, 7

Coding Exercise

Write your code below. It is recommended​ that you try solving the exercise yourself before viewing the solution.

Get hands-on with 1200+ tech skills courses.