Skip to content

Latest commit

 

History

History
73 lines (60 loc) · 1.13 KB

README.md

File metadata and controls

73 lines (60 loc) · 1.13 KB

πthon

Learn Python fundamental concepts

1. Combine Dictionaries {**fruit_emojis1, **fruit_emojis2}

fruit_emojis1 = {    
    "apple": "🍎",    
    "banana": "🍌",    
    "cherry": "🍒" 
}

fruit_emojis2 = {
    "date": "🌴",
    "grapes": "🍇",
    "kiwi": "🥝"
}

fruit_emojis = {**fruit_emojis1, **fruit_emojis2}
print(fruit_emojis)

2. Pretty printing a dictionary

from pprint import pprint

emoji = {
    "animal": {
        "dog": "🐶",
        "cat": "🐱",
        "panda": "🐼"
    },
    "fruit": {
        "cherry": "🍒",
        "strawberry": "🍓",
        "grapes": "🍇"
    },
    "fish": {
        "fish": "🐟",
        "tropical fish": "🐠",
        "blowfish": "🐡"
    }
}
pprint(emoji)

3. Print All Alphabets

from string import ascii_letters, ascii_lowercase, ascii_uppercase

print("-----")
print(ascii_letters)
print(ascii_lowercase)
print(ascii_uppercase)
print("-----")

4. Print All Numbers and Punctuations

from string import digits, punctuation

print("")
print(digits)
print(punctuation)
print("")