Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7005863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:24:17+00:00 2026-05-27T21:24:17+00:00

I am using Python 3.0 to write a program. In this program I deal

  • 0

I am using Python 3.0 to write a program. In this program I deal a lot with lists which I haven’t used very much in Python.

I am trying to write several if statements about these lists, and I would like to know how to look at just a specific value in the list. I also would like to be informed of how one would find the placement of a value in the list and input that in an if statement.

Here is some code to better explain that:

count = list.count(1)
if count > 1
    (This is where I would like to have it look at where the 1 is that the count is finding)

Thank You!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:24:18+00:00Added an answer on May 27, 2026 at 9:24 pm

    First off, I would strongly suggest reading through a beginner’s tutorial on lists and other data structures in Python: I would recommend starting with Chapter 3 of Dive Into Python, which goes through the native data structures in a good amount of detail.

    To find the position of an item in a list, you have two main options, both using the index method. First off, checking beforehand:

    numbers = [2, 3, 17, 1, 42]
    if 1 in numbers:
        index = numbers.index(1)
        # Do something interesting
    

    Your other option is to catch the ValueError thrown by index:

    numbers = [2, 3, 17, 1, 42]
    try:
        index = numbers.index(1)
    except ValueError:
        # The number isn't here
        pass
    else:
        # Do something interesting
    

    One word of caution: avoid naming your lists list: quite aside from not being very informative, it’ll shadow Python’s native definition of list as a type, and probably cause you some very painful headaches later on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a secure transfer file program using Python and AES and
I am trying to write a python program using Python 3 I have to
I am trying to write a program using python-fuse, but I can't get file
I am trying to write a VERY simple UI in Python using Tkinter. I
I have been asked to write a program using python for an assignment. I
At the moment, I am trying to write a priority queue in Python using
Using Perl, Python, or Ruby, can I write a program, probably calling Win32 API,
I'm trying to write a program to display PCM data. I've been very frustrated
I have a python practise project. I'm going to write a GUI program which
I am using Python to write chunks of text to files in a single

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.