Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 56)
56.
How can you print the sum of all odd numbers from 1 to 10?
print(sum(range(1, 11, 2)))
odd_sum(1, 10)
print(odd_numbers_sum(1, 10))
sum_odd(range(1, 11))
Answer: Option
Explanation:
To print the sum of odd numbers from 1 to 10, use print(sum(range(1, 11, 2))).
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.