#๐Ÿ”’ creating search to

23 messages ยท Page 1 of 1 (latest)

wheat fjord
#
#---import(s)---#
import time
#---------------#

#---Data---#
People=['jack rider','jennifer rider','allison Sullivan']

jack_rider_info={'fullname':'jack rider','sex':'Male','Family':'jennifer rider sister','work phone':'(203)-688-2923','personal phone':'(203)-555-0296'}
Jennifer_rider_info={'fullname':'jennifer','sex':'female','Family':'jennifer rider sister','work phone':'(203)-688-2923','personal phone':'(203)-555-0296'}
print(People)
time.sleep(1)
person_search=input("who would you like look up?:")
if person_search=='jack' or 'Jack rider':
    time.sleep(1)
    print("fullname:",jack_rider_info['fullname'])

I'm trying to make a user input inter face where if I type in Mike last name or full names it will give me that specific name or those specific materials or people who are related to this individual sorry

spiral zealotBOT
#

Hey @wheat fjord!

It looks like you incorrectly specified a language for your code block.

Make sure you put your code on a new line following py. There must not be any spaces after py.

Here is an example of how it should look:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
spiral zealotBOT
#

@wheat fjord

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

vast schooner
#

!or

spiral zealotBOT
#
The or-gotcha

When checking if something is equal to one thing or another, you might think that this is possible:

# Incorrect...
if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
wheat fjord
#

What I mean is

Steve_rider_={'First_ Name':'steven','last_name':'universe','sex':'Male'}
 
User_search=input("[search]:")
Print("here is the results of",{User_search})
#

@vast schooner

#

Sorry I forgot the person different from the last name

#

What do you think can be changed?

#

@vast schooner what do you think

split iron
#

The help panel they showed explains the problem.

wheat fjord
#

I see but what I mean is take the Name: and if it's an input of that type of search part of the engine it brings up names only the names like Prince every name and that's in many different definitions sorry

#

@vast schooner thank you

#

@split iron

split iron
#

!e

# I'd get rid of your existing "People" variable since that information can be taken from here
people = {
    'jack rider': {'fullname':'jack rider','sex':'Male','Family':'jennifer rider sister','work phone':'(203)-688-2923','personal phone':'(203)-555-0296'},
    'jennifer': {'fullname':'jennifer','sex':'female','Family':'jennifer rider sister','work phone':'(203)-688-2923','personal phone':'(203)-555-0296'}
}

print(*people.keys())

# Pretend this uses 'input'
person_search = 'jennifer'
print(people[person_search])
spiral zealotBOT
#

@split iron :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | jack rider jennifer
002 | {'fullname': 'jennifer', 'sex': 'female', 'Family': 'jennifer rider sister', 'work phone': '(203)-688-2923', 'personal phone': '(203)-555-0296'}
wheat fjord
#

Thank you

split iron
#

You're welcome.

wheat fjord
#

I'm sorry

spiral zealotBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.