Report this

What is the reason for this report?

python homework question

Posted on February 3, 2018

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



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!

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.

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.
2
>>> print(number)
2

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!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.