TGViewer
Artificial Intelligence & ChatGPT Prompts Artificial Intelligence & ChatGPT Prompts @curiousprogrammer ยท 42.2K subscribers
Post #2399 1.22K
Quick Python Cheat Sheet for Beginners ๐Ÿโœ๏ธ

Python is widely used for data analysis, automation, and AIโ€”perfect for beginners starting their coding journey.

Aggregation Functions ๐Ÿ“Š

โ€ข sum(list) โ†’ Adds all values
๐Ÿ‘‰ sum([1,2,3]) = 6
โ€ข len(list) โ†’ Counts total elements
๐Ÿ‘‰ len([1,2,3]) = 3
โ€ข max(list) โ†’ Highest value
๐Ÿ‘‰ max([4,7,2]) = 7
โ€ข min(list) โ†’ Lowest value
๐Ÿ‘‰ min([4,7,2]) = 2
โ€ข sum(list)/len(list) โ†’ Average
๐Ÿ‘‰ sum([10,20])/2 = 15

Lookup / Searching ๐Ÿ”

โ€ข in โ†’ Check existence
๐Ÿ‘‰ 5 in [1,2,5] = True
โ€ข list.index(value) โ†’ Position of value
๐Ÿ‘‰ [10,20,30].index(20) = 1
โ€ข Dictionary lookup
๐Ÿ‘‰ data = {"name": "John", "age": 25} data["name"] # John

Logical Operations ๐Ÿง 

โ€ข if condition: โ†’ Decision making
๐Ÿ‘‰ if x > 10: print("High") else: print("Low")
โ€ข and โ†’ All conditions true
โ€ข or โ†’ Any condition true
โ€ข not โ†’ Reverse condition

Text (String) Functions ๐Ÿ”ค

โ€ข len(text) โ†’ Length
๐Ÿ‘‰ len("hello") = 5
โ€ข text.lower() โ†’ Lowercase
โ€ข text.upper() โ†’ Uppercase
โ€ข text.strip() โ†’ Remove spaces
๐Ÿ‘‰ " hi ".strip() = "hi"
โ€ข text.replace(old, new)
๐Ÿ‘‰ "hi".replace("h","H") = "Hi"
โ€ข String concatenation
๐Ÿ‘‰ "Hello " + "World"

Date Time Functions ๐Ÿ“…

โ€ข from datetime import datetime
โ€ข datetime.now() โ†’ Current date time
โ€ข Extract values:
now = datetime.now() now.year now.month now.day

Math Functions โž—

โ€ข import math
โ€ข math.sqrt(x) โ†’ Square root
โ€ข math.ceil(x) โ†’ Round up
โ€ข math.floor(x) โ†’ Round down
โ€ข abs(x) โ†’ Absolute value

Conditional Aggregation (Like Excel SUMIF) โšก

โ€ข Using list comprehension

nums = [10, 20, 30, 40] sum(x for x in nums if x > 20) # 70

โ€ข Count condition

len([x for x in nums if x > 20]) # 2

Pro Tip for Data Analysts ๐Ÿ’ก

๐Ÿ‘‰ For real-world work, use libraries: pandas & numpy

Example:
import pandas as pd df["salary"].mean()

Python Resources: https://whatsapp.com/channel/0029VaiM08SDuMRaGKd9Wv0L

Double Tap โ™ฅ๏ธ For More
  • โค 4
More from @curiousprogrammer
  1. Oct 4, 2026Frontend vs Backend Developer โœ…
  2. Sep 29, 2026๐—™๐—ฅ๐—˜๐—˜ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—”๐—œ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ๐Ÿš€ โ€‹ Explore 6 free resourceโ€ฆ
  3. Sep 28, 2026๐Ÿง  SQL Basics Cheatsheet ๐Ÿ“Š๐Ÿ› ๏ธ 1. What is SQL? SQL (Structured Query Language) is used toโ€ฆ
  4. Sep 28, 2026๐ŸŽ“ ๐—›๐—”๐—ฅ๐—ฉ๐—”๐—ฅ๐—— ๐—จ๐—ก๐—œ๐—ฉ๐—˜๐—ฅ๐—ฆ๐—œ๐—ง๐—ฌ ๐—™๐—ฅ๐—˜๐—˜ ๐—ข๐—ก๐—Ÿ๐—œ๐—ก๐—˜ ๐—–๐—ข๐—จ๐—ฅ๐—ฆ๐—˜๐—ฆ ๐Ÿ˜ Dreaming ofโ€ฆ
  5. Sep 27, 2026โœ… Top Tech Career Paths to Explore in 2026 ๐Ÿ’ป๐Ÿš€ 1. Software Developer Builds websites, appโ€ฆ
  6. Sep 27, 2026๐—Ÿ๐—ฒ๐˜ƒ๐—ฒ๐—น ๐—จ๐—ฝ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ฆ๐—ธ๐—ถ๐—น๐—น๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—ง๐—ต๐—ฒ๐˜€๐—ฒ ๐—š๐—ฎ๐—บ๐—ฒ-๐—–๐—ต๐—ฎ๐—ป๐—ด๐—ถ๐—ป๐—ด ๐—–๐—ผ๐˜‚โ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’