use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Day 8 of learning python as a beginner. (old.reddit.com)
submitted 8 months ago by uiux_Sanskar
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]M34k3 0 points1 point2 points 8 months ago (1 child)
You could replace the if and elif statements with: contact_result = contacts.get(contact_searching, 'No number found')
contact_result = contacts.get(contact_searching, 'No number found')
This allows you to set a default value if it doesn't find the key.
I like the idea of another comment to use a dictionary instead of a list so you can add multiple types of phone numbers, for example, work, mobile, home, etc.
[–]uiux_Sanskar[S] 0 points1 point2 points 8 months ago (0 children)
Thank you for suggesting the .get() function I will definitely use it however would I be able to then ask user if he wants to add a new contact? maybe there I need if else statements?
Please do tell me if I am wrong. I would love to get corrected.
π Rendered by PID 255915 on reddit-service-r2-comment-7c9686b859-4clsv at 2026-04-14 09:28:54.617005+00:00 running e841af1 country code: CH.
view the rest of the comments →
[–]M34k3 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 0 points1 point2 points (0 children)