Write a statement which assigns all the odd integer values between 0 and 10 (in order) to the variable named odds. Python Language
1.Simple way--
odds=[1,3,5,7,9]
The screenshot of this statement and output is given below.
2.Using loop
odds=[]
for i in range(0,10):
if(i%2!=0):
odds.append(i)
print(odds)
The screenshot of the code and output is given below.
If the answer helped please upvote it means a lot. For any
query please comment.
Get Answers For Free
Most questions answered within 1 hours.