How to check that with help of loop

1) Write a program to accept a list from the user and print the alternate element of list.

l1 = int(input("how many element you want to enter :"))
l2 = int(input("how many element you want to enter :"))
for i in range(l1):
        print(i)
    for j in range(l2,1):
        print(j)

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

We have asked you before - please actually describe what is wrong with your code and where you are stuck. We aren’t here to fix your homework for you. We’re here to help you learn how to fix your own issues.

i wanna print alternate value by taking user input , on that i am using loop …

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.