Question

Loop Prints hand traced in python. What is the output? Instead of using newlines to separate,...

Loop Prints hand traced in python. What is the output? Instead of using newlines to separate, use comma to separate each line ie. (a,b,c,...)

for i in range(1, 10):

if i % 2 == 0:

print(i, end=",")

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Output is
2,4,6,8,

Explanation

  • range(1, 10) gives numbers from 1 to 9
  • condition checks if the number is even because it is checking if the number is divisible by 2 leaving reminder of 0
  • Printing i with a comma after each number
Add a comment
Know the answer?
Add Answer to:
Loop Prints hand traced in python. What is the output? Instead of using newlines to separate,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT