forked from TheAlgorithms/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Panagram Script Added (TheAlgorithms#1564)
* Python Program that fetches top trending news * Python Program that fetches top trending news * Revisions in Fetch BBC News * psf/black Changes * Python Program to send slack message to a channel * Slack Message Revision Changes * Python Program to check Palindrome String * Doctest Added * Python Program to check whether a String is Panagram or not * Python Program to check whether a String is Panagram or not * Check Panagram Script Added * Panagram Script Added * Anagram Script Changes * Anagram Alphabet Check Added * Python Program to fetch github info
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Created by sarathkaul on 12/11/19 | ||
|
||
|
||
def check_panagram( | ||
input_str: str = "The quick brown fox jumps over the lazy dog", | ||
) -> bool: | ||
""" | ||
A Panagram String contains all the alphabets at least once. | ||
>>> check_panagram("The quick brown fox jumps over the lazy dog") | ||
True | ||
>>> check_panagram("My name is Unknown") | ||
False | ||
>>> check_panagram("The quick brown fox jumps over the la_y dog") | ||
False | ||
""" | ||
frequency = set() | ||
input_str = input_str.replace( | ||
" ", "" | ||
) # Replacing all the Whitespaces in our sentence | ||
for alpha in input_str: | ||
if "a" <= alpha.lower() <= "z": | ||
frequency.add(alpha.lower()) | ||
|
||
return True if len(frequency) == 26 else False | ||
|
||
|
||
if __name__ == "main": | ||
check_str = "INPUT STRING" | ||
status = check_panagram(check_str) | ||
print(f"{check_str} is {'not ' if status else ''}a panagram string") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Created by sarathkaul on 14/11/19 | ||
|
||
import requests | ||
|
||
_GITHUB_API = "https://api.github.com/user" | ||
|
||
|
||
def fetch_github_info(auth_user: str, auth_pass: str) -> None: | ||
# fetching github info using requests | ||
info = requests.get(_GITHUB_API, auth=(auth_user, auth_pass)) | ||
|
||
for a_info, a_detail in info.json().items(): | ||
print(f"{a_info}: {a_detail}") | ||
|
||
|
||
if __name__ == "main": | ||
fetch_github_info("<USER NAME>", "<PASSWORD>") |