Skip to content
murmot

Results for “python string array example question code java site:discuss.python.org interview”

  • discuss.python.org

    Comparing values in an array - Python Help - Discussions on ...

    Sep 8, 2022 · Hi, I am looking to write a short code to compare values in an array. For example, I want to have a list of values in a text file and then have each value compared to all of the other values to find out which ones are within 8 of each other. Example: 8, 9, 20, 22, 40, 39.

  • discuss.python.org

    Question about string sequencing and slicing - Python Help...

    Discussions on Python.org. Question about string sequencing and slicing.Python starts counting from 0, not 1. Slices are “half-open”, so the starting position is included and the ending position is excluded. For example, let’s look at your string ‘Michael’.

  • discuss.python.org

    I am not able to understand and solve the question - Python ...

    Aug 6, 2023 · So, that pyt ‘sub-string’ is three characters in length and is a so-called ‘slice’ of the name object to which the string python has been assigned and is constructed from index position 0 up to, but not including, index position 3.

  • discuss.python.org

    Discussions on Python.org

    Discussions related to the Python Programming Language, Python Community, and Python Software Foundation operations.

  • discuss.python.org

    How to check if a dictionary element is an array - Python ...

    Jul 19, 2024 · Now, regarding your question, here is an example that hopefully helps you to understand the concept. Note that you do not need to explicitly define the icon string in brackets as per your query. You only need to define its location via diction ['d'] [1] (dictionary diction, element d, index 1 from the list/array).

  • discuss.python.org

    How to make an addition operetion using f-strings? - Python Help...

    Hello everyone, python newbie here. Just started learning python and been wondering if I can make addition operations using f-string. Learned about f-strings with this example: name = “John” age = 23 cash = 50 f"{name} is {age} years old and has {cash} bucks on his pocket."

  • discuss.python.org

    How to write a function that returns a simple string value

    Oct 11, 2022 · Help please. I have to write a simple function that returns a string. The string (in this example) is a city and a country e.g. London, England I have done some other exercises where I return a formatted name e.g. Bob Johnson, but I cannot get this one right Here is my codes so far: def city_country(city_name, country_name): """Return a string value of information about a city and country ...

  • discuss.python.org

    Comparing Strings - Python Help - Discussions on Python.org

    Jul 11, 2023 · The condition already represents what we want. As it happens, Python allows us to express this view of the problem almost directly. We want to know whether all examples of a character (let’s call it c) are in letters_guessed, where we repeat the check for each of the c examples that is in secret_word. The corresponding Python code is in that ...