python homework question

i have one question which i could not able to solve ,if anybody please help me to solve this question,it would be greate help from your side, thank you

iam using windows in my home python 2.7.13 and in workplace iam using ubuntu python version 2.7.12 i have a list of number 1 to 10 first print the number then prompt should ask the user please select your number if the user select number 6 then except number 6 all other number should display,but number 6 should not dispaly

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there! Sounds like you’re learning Python. There are a lot of great resources out there to help you get started. Dive Into Python is a favorite of mine and available for free online. In fact there are quite a few introductory Python tutorials right here on the DigitalOcean community site. We even compiled them into a free ebook:

Here’s a hint to point you in the right direction: You can prompt a user and capture their input using the builtin input function. For example:

>>> number = input("Choose a number between 1 and 10.\n")
Choose a number between 1 and 10.
>>> print(number)

After getting that input, you could use a “for loop” to iterate over your set of numbers, comparing them to the input. Then using a conditional statement, if the number doesn’t match, print it. If it does match, just move one to the next.

Hope that helps point you in the right direction!