Hey!

Hey! How can I help you today?

Act as an expert biology tutor. I am studying NCERT Class 12 Biology, Chapter 4: Principles of Inheritance and Variation. Please explain [INSERT CH-4 TOPIC HERE] step-by-step. Follow these 4 strict guidelines: 1. Keep the language simple, direct, and strictly aligned with the NCERT Class 12 syllabus definitions. 2. Use bullet points, bold key terms, and provide a clear comparison table or cross layout (like a Punnett square breakdown) if applicable. 3. Provide a clever mnemonic or memory trick to help me remember the key ratios, examples, or symptoms. 4. End with 3 challenging multiple-choice questions (with an answer key hidden at the very bottom) so I can test my active recall.

Asking for Preferences

Full chapter 100% ncert cover according to CBSE 2026-2027 for boards level

Searching the Web

CBSE 2026-27 Class 12 Biology Chapter 4 Principles of Inheritance Variation syllabus topics

Finding Sources
Reading Web Page

https://cdnbbsr.s3waas.gov.in/s3kv03b7b00c918a9674f4256026aa…


πŸ“˜ Class 12 Biology - Chapter 4: Principles of Inheritance and Variation

Complete NCERT Coverage | CBSE 2026-27 Board Level


πŸ”‘ Key Terms First (Know These Cold)

TermDefinition
GeneticsStudy of inheritance and variation
HeredityTransmission of characters from parents to offspring
VariationDifferences between parents and offspring
GeneA unit of inheritance (discrete factor)
AlleleAlternative forms of a gene (e.g., T and t)
HomozygousBoth alleles are same (TT or tt) - true breeding
HeterozygousAlleles are different (Tt)
PhenotypeObservable character (e.g., Tall)
GenotypeGenetic makeup (e.g., Tt)
DominantAllele that expresses in heterozygous condition
RecessiveAllele that is masked in heterozygous condition
Mnemonic - "Gene Hunters Have Absolutely Perfect Genuine Dedication" G-ene, H-eredity, H-omozygous, A-llele, P-henotype, G-enotype, D-ominant

πŸ“Œ TOPIC 1: Mendel and His Experiments

Why Mendel Succeeded (Others Failed)

  • He chose pea plant (Pisum sativum) - short life cycle, easy to grow
  • He studied 7 pairs of contrasting characters (one at a time first)
  • He used statistics and mathematics - a totally new approach in biology
  • He maintained large sample sizes - reduced error

Mendel's 7 Characters in Pea Plant

CharacterDominant TraitRecessive Trait
Stem heightTall (T)Dwarf (t)
Seed shapeRound (R)Wrinkled (r)
Seed colourYellow (Y)Green (y)
Pod shapeInflated (I)Constricted (i)
Pod colourGreen (G)Yellow (g)
Flower positionAxial (A)Terminal (a)
Flower colourViolet (V)White (v)
Mnemonic - "The Silly Yellow Pigs Go Around Villages" T-all, S-hape(seed), Y-ellow, P-od(shape), G-reen(pod), A-xial, V-iolet

πŸ“Œ TOPIC 2: Mendel's Laws of Inheritance

Law 1 - Law of Dominance

  • Characters are controlled by discrete units called factors (genes)
  • Factors occur in pairs
  • In a heterozygous pair, one factor dominates the other
  • The dominant allele expresses itself, recessive stays hidden

Law 2 - Law of Segregation (Most Important!)

"During gamete formation, the two alleles of a character pair in parents segregate from each other so that a gamete receives only ONE of the two alleles."

Monohybrid Cross - Step by Step

Cross: Tall (TT) Γ— Dwarf (tt)
P generation: TT Γ— tt
Gametes: T and T from parent 1; t and t from parent 2
F1 generation: All Tt (Tall) - only dominant trait visible
F1 Γ— F1 cross (Tt Γ— Tt):
        T          t
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
T  β”‚  TT     β”‚   Tt    β”‚
   β”‚ (Tall)  β”‚ (Tall)  β”‚
   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
t  β”‚  Tt     β”‚   tt    β”‚
   β”‚ (Tall)  β”‚ (Dwarf) β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Phenotypic ratio F2 = 3 Tall : 1 Dwarf (3:1)
  • Genotypic ratio F2 = 1 TT : 2 Tt : 1 tt (1:2:1)
Mnemonic for Monohybrid ratios: "3 for Show, 1 Below" (3:1 phenotype) and "1-2-1 is the genotype fun"

Test Cross

  • Crossing an organism of unknown genotype with a homozygous recessive parent (tt)
  • If offspring are all tall β†’ unknown parent was TT
  • If offspring are 50% tall, 50% dwarf β†’ unknown parent was Tt

Law 3 - Law of Independent Assortment

"When two or more pairs of characters are inherited together, the segregation of one pair is independent of the other pair."

Dihybrid Cross - Step by Step

Cross: Round Yellow (RRYY) Γ— Wrinkled Green (rryy)
F1: All RrYy (Round Yellow)
F1 Γ— F1 (RrYy Γ— RrYy):
           RY       Ry       rY       ry
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
 RY   β”‚ RRYY  β”‚ RRYy  β”‚ RrYY  β”‚ RrYy  β”‚
      β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
 Ry   β”‚ RRYy  β”‚ RRyy  β”‚ RrYy  β”‚ Rryy  β”‚
      β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
 rY   β”‚ RrYY  β”‚ RrYy  β”‚ rrYY  β”‚ rrYy  β”‚
      β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
 ry   β”‚ RrYy  β”‚ Rryy  β”‚ rrYy  β”‚ rryy  β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Phenotypic ratio F2 = 9 Round Yellow : 3 Round Green : 3 Wrinkled Yellow : 1 Wrinkled Green
  • = 9:3:3:1
Mnemonic for 9:3:3:1 - "Nine Three Three One - Big Families Need Love" (9 is the biggest, 1 is the loner)

πŸ“Œ TOPIC 3: Deviations from Mendelism

3A - Incomplete Dominance

  • Neither allele is fully dominant
  • Heterozygous offspring shows an intermediate phenotype
  • Example: Snapdragon / Antirrhinum - Red (RR) Γ— White (rr) β†’ Pink (Rr)
Cross: RR Γ— rr β†’ F1: all Rr (Pink) F1 Γ— F1: Rr Γ— Rr
         R        r
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
 R  β”‚  RR   β”‚   Rr   β”‚
    β”‚ (Red)  β”‚ (Pink) β”‚
    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
 r  β”‚  Rr   β”‚   rr   β”‚
    β”‚ (Pink) β”‚(White) β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜
F2 Phenotypic ratio = 1 Red : 2 Pink : 1 White (1:2:1)
  • Note: Here phenotypic ratio = genotypic ratio = 1:2:1
Memory trick: "Incomplete = 1:2:1 (same as genotype ratio)"

3B - Codominance

  • Both alleles express simultaneously and equally in heterozygous condition
  • Example: ABO Blood Groups (IA and IB are codominant; i is recessive)

3C - Multiple Alleles

  • More than two alleles for the same gene exist in a population (but any individual has only 2)
  • Example: ABO Blood Group system - three alleles: IA, IB, i

ABO Blood Group Inheritance Table

Blood Group (Phenotype)Genotype(s)
AIAIA or IAi
BIBIB or IBi
ABIAIB
Oii
Key: IA and IB are dominant over i; IA and IB are codominant with each other
Mnemonic for blood groups: "Amar Aur Biru Aate Indian Badminton International Karke" A = IAIA/IAi, B = IBIB/IBi, AB = IAIB, O = ii

3D - Pleiotropy

  • One gene controls many (multiple) traits
  • Example: Gene for seed texture in pea (round/wrinkled) also affects starch synthesis
  • Example in humans: Phenylketonuria (PKU) - one gene defect affects skin colour, mental ability, urine odour
Memory trick: "PLEIOtropy = PLEnty of effects from ONE gene"

3E - Polygenic Inheritance

  • Many genes control one trait (opposite of pleiotropy)
  • Shows continuous variation
  • Example: Skin colour in humans, height, grain colour in wheat
  • The more dominant alleles, the darker the phenotype
Memory trick: "PolyGENIC = Many GENES β†’ One trait" (Poly = many)

πŸ“Œ TOPIC 4: Chromosomal Theory of Inheritance

Sutton and Boveri (1902) proposed that:

  • Chromosomes are the carriers of genes
  • Genes are located on chromosomes
  • Behavior of chromosomes during meiosis explains Mendel's laws

Key Points:

  • Both chromosomes and Mendelian factors (genes) occur in pairs
  • They separate during gamete formation
  • They are independently inherited (independent assortment = independent chromosome movement)

πŸ“Œ TOPIC 5: Linkage and Crossing Over

Linkage

  • Genes located on the same chromosome tend to be inherited together
  • They do NOT follow the law of independent assortment
  • Thomas Hunt Morgan worked on Drosophila melanogaster (fruit fly) - short life cycle, many offspring, easy to culture, many visible mutations

Crossing Over

  • Exchange of genetic material between non-sister chromatids of homologous chromosomes during meiosis I (prophase I)
  • This creates new combinations of genes (recombinants)
  • Recombination frequency = (Recombinant offspring / Total offspring) Γ— 100
  • Used to construct genetic maps / linkage maps
Memory trick: "Crossing over CROSSES the barrier of linkage to CREATE recombinants"

πŸ“Œ TOPIC 6: Sex Determination

In Humans (XX-XY Type)

  • Females: 44 + XX (homogametic - produce only one type of gamete)
  • Males: 44 + XY (heterogametic - produce two types of gametes)
  • Sex is determined by the FATHER (who contributes either X or Y)
Mother (XX) Γ— Father (XY)
     ↓               ↓
  X gametes    X gametes + Y gametes
  
Offspring: XX (Female) or XY (Male) - 50:50 ratio

In Birds (ZW-ZZ Type)

  • Females: ZW (heterogametic - determine sex)
  • Males: ZZ (homogametic)
  • Sex is determined by the MOTHER in birds

In Honey Bee (Haploid-Diploid / Arrhenotoky)

  • Males (Drones): Haploid - develop from unfertilized eggs (parthenogenesis)
  • Females (Queen/Worker): Diploid - develop from fertilized eggs
OrganismFemaleMaleWho determines sex?
HumansXXXYFather
BirdsZWZZMother
GrasshopperXXXO-
Honey bee2n (diploid)n (haploid)-
Mnemonic: "Humans XY Father, Birds ZW Mother, Bees are Lazy (haploid males from eggs)"

πŸ“Œ TOPIC 7: Sex-Linked Inheritance

What is Sex-Linked Inheritance?

  • Genes located on sex chromosomes (especially X chromosome) show sex-linked inheritance
  • Called X-linked traits mostly

Haemophilia (X-Linked Recessive)

  • A disorder where blood does not clot normally (deficiency of clotting factors VIII or IX)
  • More common in males (only one X chromosome - if it has the defective allele, disease appears)
GenotypeSexPhenotype
XHXHFemaleNormal
XHXhFemaleCarrier (normal phenotype)
XhXhFemaleHaemophilic
XHYMaleNormal
XhYMaleHaemophilic
Key Cross: Carrier Female Γ— Normal Male
Mother: XHXh  Γ—  Father: XHY
Gametes: XH, Xh    XH, Y

Offspring: XHXH (Normal female), XHXh (Carrier female),
           XHY (Normal male), XhY (Haemophilic male)
  • 25% chance of haemophilic son
Historical Example: Queen Victoria of England was a carrier. Her son Leopold had haemophilia.

Colour Blindness (X-Linked Recessive)

  • Inability to distinguish red and green colours
  • Same inheritance pattern as haemophilia
  • Males are more commonly affected
Mnemonic: "Males are MORE LIKELY to show X-linked disorders because they have only ONE X - No spare copy to rescue them!"

πŸ“Œ TOPIC 8: Mutation

Definition

Mutation = A sudden, heritable change in the genetic material (DNA sequence or chromosome number/structure)

Types of Mutations

1. Gene/Point Mutations
  • Change in a single base pair of DNA
  • Example: Sickle Cell Anaemia - GAG β†’ GUG in mRNA (Glutamic acid β†’ Valine)
2. Chromosomal Mutations / Aberrations
  • Changes in chromosome structure (deletion, duplication, inversion, translocation)
  • Changes in chromosome number (aneuploidy, polyploidy)

Aneuploidy

  • Abnormal chromosome number due to non-disjunction during meiosis
  • Trisomy: 2n + 1 (one extra chromosome)
  • Monosomy: 2n - 1 (one chromosome missing)

πŸ“Œ TOPIC 9: Pedigree Analysis

What is Pedigree Analysis?

  • A diagrammatic representation of inheritance of a trait across generations in a family
  • Used to determine whether a trait is dominant or recessive, autosomal or sex-linked

Symbols Used

SymbolMeaning
β—‹Normal female
β–‘Normal male
●Affected female
β– Affected male
β—‘ / β—§Carrier female / Carrier male
=Mating / Marriage
β”‚Offspring

How to Determine Inheritance Pattern

ObservationConclusion
Trait skips generationsRecessive
Every generation shows traitDominant
Only males affectedX-linked recessive likely
Affected father has affected sonsAutosomal
Carrier mothers pass to sonsX-linked
Mnemonic: "SKIP = Recessive, EVERY GEN = Dominant, ONLY MALES = X-linked"

πŸ“Œ TOPIC 10: Genetic Disorders

A. Chromosomal Disorders

1. Down Syndrome (Trisomy 21)

  • Cause: Trisomy of chromosome 21 (47 chromosomes total: 2n+1)
  • Symptoms:
    • Short stature, small round head
    • Furrowed tongue, partially open mouth
    • Broad palm with characteristic crease
    • Epicanthic eye folds
    • Mental retardation
    • 45Β° angle between big and 2nd toe
  • More common in children of older mothers (non-disjunction increases with maternal age)

2. Klinefelter's Syndrome (XXY)

  • Cause: 47 chromosomes with XXY sex chromosomes
  • Phenotype: Male
  • Symptoms:
    • Overall masculine development
    • Gynaecomastia (breast development in males)
    • Sterile (cannot produce sperm)

3. Turner's Syndrome (XO or 45, X)

  • Cause: 45 chromosomes with only one X (monosomy of X)
  • Phenotype: Female
  • Symptoms:
    • Short stature
    • Ovaries are rudimentary (sterile)
    • Webbed neck
    • Underdeveloped breasts (lack of secondary sexual characters)
Mnemonic for chromosomal disorders: "Down's goes Down to 21, Kline has an EXTRA X makes male BREASTS, Turner has ONLY ONE X with webbed neck"

Comparison Table: Chromosomal Disorders

FeatureDown SyndromeKlinefelter'sTurner's
Chromosome number47 (trisomy 21)47 (XXY)45 (XO)
SexMale/FemaleMaleFemale
Key featureMental retardationGynaecomastiaWebbed neck
FertilityReducedSterileSterile

B. Mendelian / Gene Disorders

1. Sickle Cell Anaemia (Autosomal Recessive)

  • Cause: Mutation in beta-globin gene - GAG β†’ GUG codon change
  • This changes amino acid Glutamic acid β†’ Valine in haemoglobin
  • HbS (abnormal haemoglobin) forms long fibres that make RBCs sickle-shaped
  • Carriers (Hb^A Hb^S): Partially resistant to malaria - evolutionary advantage
GenotypeCondition
Hb^A Hb^ANormal
Hb^A Hb^SCarrier (Sickle cell trait)
Hb^S Hb^SSickle cell anaemia

2. Phenylketonuria (PKU) (Autosomal Recessive)

  • Cause: Lack of enzyme phenylalanine hydroxylase
  • Phenylalanine accumulates β†’ cannot be converted to tyrosine
  • Symptoms: Mental retardation, light skin and hair (less melanin), musty body odour
  • Example of pleiotropy (one gene, multiple effects)

3. Thalassemia (Autosomal Recessive)

  • Cause: Reduced synthesis of alpha or beta globin chains of haemoglobin (not a structural change - a quantitative reduction)
  • Alpha thalassemia: genes on chromosome 16
  • Beta thalassemia: genes on chromosome 11
  • Differ from sickle cell anaemia: here globin chains are quantitatively deficient, not structurally abnormal
Key distinction to remember: Sickle Cell = structural change in Hb; Thalassemia = reduced production of Hb chains
Mnemonic for Mendelian disorders: "SiPhThal" - Si(ckle cell), Ph(enylketonuria), Thal(assemia) - ALL autosomal recessive

🧠 MASTER RATIOS QUICK REFERENCE

Cross TypeF2 Phenotypic RatioF2 Genotypic Ratio
Monohybrid3:11:2:1
Dihybrid9:3:3:11:2:1:2:4:2:1:2:1
Incomplete Dominance1:2:11:2:1
Test Cross (Tt Γ— tt)1:11:1
Codominance (AB group)Equal expressionIAIB
THE GOLDEN MNEMONIC for all ratios: "Mono is 3:1, Di is 9:3:3:1, Incomplete flips to 1:2:1, Test gives 1:1" Or: "3-1 / 9-3-3-1 / 1-2-1 / 1-1" - say it like a chant!


πŸ§ͺ 3 Challenging MCQs - Test Your Recall!


Q1. In a cross between a carrier female for haemophilia (X^H X^h) and a normal male (X^H Y), what is the probability that a SON born will have haemophilia?
  • (A) 25%
  • (B) 50%
  • (C) 100%
  • (D) 0%

Q2. A man with blood group A (genotype IAi) marries a woman with blood group B (genotype IBi). Which of the following blood groups is NOT possible in their children?
  • (A) A
  • (B) O
  • (C) AB
  • (D) All of the above are possible

Q3. In snapdragon (Antirrhinum), a red-flowered plant (RR) is crossed with a white-flowered plant (rr). The F1 plants (Rr) are self-pollinated. What will be the phenotypic ratio in F2?
  • (A) 3 Red : 1 White
  • (B) 1 Red : 2 Pink : 1 White
  • (C) 1 Red : 1 White
  • (D) All Red


⚠️ Answer key is hidden below. Try answering first before scrolling!











βœ… Answer Key

QuestionAnswerExplanation
Q1(B) 50%Cross gives X^H X^H, X^H X^h, X^H Y, X^h Y. Among sons only (X^H Y and X^h Y), 1 in 2 sons = 50% are haemophilic.
Q2(D) All are possibleIAi Γ— IBi gives IAIB (AB), IAi (A), IBi (B), ii (O). All 4 blood groups are possible! This is a classic trap question.
Q3(B) 1 Red : 2 Pink : 1 WhiteThis is incomplete dominance. F2 genotypic ratio = 1RR : 2Rr : 1rr = 1 Red : 2 Pink : 1 White. Phenotypic ratio = genotypic ratio here.

Pro tip for Boards: Punnett squares, chromosome disorder tables, and blood group crosses are very high yield. Practice drawing the 4Γ—4 dihybrid Punnett square from memory - it appears almost every year in some form!

Can I get a pdf of these full notes

Reading File
Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace not found"

Running Command

mkdir -p /home/daytona/workspace/bio-ch4-notes

Writing File

~/bio-ch4-notes/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame

OUTPUT = "/home/daytona/workspace/bio-ch4-notes/Ch4_Inheritance_Variation_Notes.pdf"

# ── Colours ──────────────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1a237e")
MID_BLUE    = colors.HexColor("#1565c0")
LIGHT_BLUE  = colors.HexColor("#e3f2fd")
GREEN       = colors.HexColor("#1b5e20")
LIGHT_GREEN = colors.HexColor("#e8f5e9")
ORANGE      = colors.HexColor("#e65100")
YELLOW_BG   = colors.HexColor("#fffde7")
GREY_BG     = colors.HexColor("#f5f5f5")
RED         = colors.HexColor("#b71c1c")
TEAL        = colors.HexColor("#006064")
PURPLE      = colors.HexColor("#4a148c")

# ── Styles ────────────────────────────────────────────────────────────────────
ss = getSampleStyleSheet()

def make_style(name, parent="Normal", **kwargs):
    return ParagraphStyle(name, parent=ss[parent], **kwargs)

title_style = make_style("MyTitle", parent="Title",
    fontSize=22, textColor=DARK_BLUE, spaceAfter=4,
    fontName="Helvetica-Bold", alignment=TA_CENTER)

subtitle_style = make_style("MySubtitle",
    fontSize=11, textColor=MID_BLUE, spaceAfter=2,
    fontName="Helvetica", alignment=TA_CENTER)

chapter_style = make_style("ChapterH",
    fontSize=15, textColor=colors.white, spaceAfter=6, spaceBefore=14,
    fontName="Helvetica-Bold", backColor=DARK_BLUE,
    borderPad=6, leading=20)

topic_style = make_style("TopicH",
    fontSize=12, textColor=colors.white, spaceAfter=4, spaceBefore=10,
    fontName="Helvetica-Bold", backColor=MID_BLUE,
    borderPad=5, leading=17)

sub_style = make_style("SubH",
    fontSize=11, textColor=DARK_BLUE, spaceAfter=3, spaceBefore=6,
    fontName="Helvetica-Bold")

body_style = make_style("MyBody",
    fontSize=9.5, leading=14, spaceAfter=3,
    fontName="Helvetica")

bullet_style = make_style("MyBullet",
    fontSize=9.5, leading=13, spaceAfter=2,
    leftIndent=14, firstLineIndent=0,
    fontName="Helvetica")

mnemonic_style = make_style("Mnemonic",
    fontSize=9.5, leading=13, spaceAfter=4,
    fontName="Helvetica-BoldOblique", textColor=PURPLE,
    backColor=YELLOW_BG, borderPad=6, leftIndent=8, rightIndent=8)

note_style = make_style("Note",
    fontSize=9, leading=13, spaceAfter=4,
    fontName="Helvetica-Oblique", textColor=TEAL,
    backColor=LIGHT_GREEN, borderPad=5, leftIndent=8, rightIndent=8)

mcq_q_style = make_style("McqQ",
    fontSize=10, leading=14, spaceAfter=3, spaceBefore=6,
    fontName="Helvetica-Bold", textColor=DARK_BLUE)

mcq_opt_style = make_style("McqOpt",
    fontSize=9.5, leading=13, spaceAfter=1, leftIndent=16,
    fontName="Helvetica")

answer_style = make_style("Ans",
    fontSize=9.5, leading=13, spaceAfter=2,
    fontName="Helvetica", textColor=GREEN)

# ── Helper builders ───────────────────────────────────────────────────────────
def h_chapter(text):
    return [Paragraph(text, chapter_style), Spacer(1, 2)]

def h_topic(text):
    return [Spacer(1, 4), Paragraph(text, topic_style), Spacer(1, 3)]

def h_sub(text):
    return [Paragraph(text, sub_style)]

def body(text):
    return Paragraph(text, body_style)

def bullet(text):
    return Paragraph(f"•  {text}", bullet_style)

def mnemonic(text):
    return Paragraph(f"<b>Mnemonic:</b> {text}", mnemonic_style)

def note(text):
    return Paragraph(f"<b>Note:</b> {text}", note_style)

def spacer(h=4):
    return Spacer(1, h)

def hr():
    return HRFlowable(width="100%", thickness=0.5, color=colors.lightgrey, spaceAfter=4, spaceBefore=4)

def make_table(data, col_widths=None, header_bg=DARK_BLUE, header_fg=colors.white,
               alt_bg=LIGHT_BLUE, row_bg=colors.white, font_size=8.5):
    style = TableStyle([
        ("BACKGROUND",   (0,0), (-1,0),  header_bg),
        ("TEXTCOLOR",    (0,0), (-1,0),  header_fg),
        ("FONTNAME",     (0,0), (-1,0),  "Helvetica-Bold"),
        ("FONTSIZE",     (0,0), (-1,-1), font_size),
        ("ALIGN",        (0,0), (-1,-1), "LEFT"),
        ("VALIGN",       (0,0), (-1,-1), "MIDDLE"),
        ("ROWBACKGROUNDS",(0,1),(-1,-1), [row_bg, alt_bg]),
        ("GRID",         (0,0), (-1,-1), 0.4, colors.HexColor("#b0bec5")),
        ("LEFTPADDING",  (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING",   (0,0), (-1,-1), 4),
        ("BOTTOMPADDING",(0,0), (-1,-1), 4),
    ])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    t.setStyle(style)
    return t

def punnett_table(col_headers, row_headers, cells, title="Punnett Square"):
    data = [[""] + col_headers]
    for rh, row in zip(row_headers, cells):
        data.append([rh] + row)
    style = TableStyle([
        ("BACKGROUND",   (0,0), (-1,0),  MID_BLUE),
        ("BACKGROUND",   (0,0), (0,-1),  MID_BLUE),
        ("TEXTCOLOR",    (0,0), (-1,0),  colors.white),
        ("TEXTCOLOR",    (0,0), (0,-1),  colors.white),
        ("FONTNAME",     (0,0), (-1,-1), "Helvetica-Bold"),
        ("FONTSIZE",     (0,0), (-1,-1), 9),
        ("ALIGN",        (0,0), (-1,-1), "CENTER"),
        ("VALIGN",       (0,0), (-1,-1), "MIDDLE"),
        ("GRID",         (0,0), (-1,-1), 0.8, DARK_BLUE),
        ("LEFTPADDING",  (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
        ("TOPPADDING",   (0,0), (-1,-1), 7),
        ("BOTTOMPADDING",(0,0), (-1,-1), 7),
        ("ROWBACKGROUNDS",(1,1),(-1,-1), [LIGHT_BLUE, LIGHT_GREEN]),
    ])
    t = Table(data)
    t.setStyle(style)
    return t

# ── Build story ────────────────────────────────────────────────────────────────
story = []

# Cover block
story += [
    spacer(30),
    Paragraph("Class 12 Biology", subtitle_style),
    Paragraph("Chapter 4", subtitle_style),
    Paragraph("Principles of Inheritance", title_style),
    Paragraph("and Variation", title_style),
    spacer(4),
    Paragraph("Complete NCERT Notes | CBSE 2026-27 Board Level", subtitle_style),
    spacer(6),
    HRFlowable(width="60%", thickness=2, color=MID_BLUE, spaceAfter=6),
    Paragraph("Covers: Mendel's Laws | Deviations | Sex Determination | Linkage |<br/>Mutation | Pedigree | Genetic Disorders | MCQs", subtitle_style),
    spacer(30),
    PageBreak(),
]

# ═══════════════════════════════════════════════════════════════════
# SECTION: KEY TERMS
# ═══════════════════════════════════════════════════════════════════
story += h_chapter("KEY TERMS")

terms_data = [
    ["Term", "Definition"],
    ["Genetics", "Study of inheritance and variation"],
    ["Heredity", "Transmission of characters from parents to offspring"],
    ["Variation", "Differences between parents and offspring"],
    ["Gene", "A unit of inheritance (discrete factor)"],
    ["Allele", "Alternative forms of a gene (e.g. T and t)"],
    ["Homozygous", "Both alleles are same (TT or tt) - true breeding"],
    ["Heterozygous", "Alleles are different (Tt)"],
    ["Phenotype", "Observable character (e.g. Tall)"],
    ["Genotype", "Genetic makeup (e.g. Tt)"],
    ["Dominant", "Allele that expresses in heterozygous condition"],
    ["Recessive", "Allele that is masked in heterozygous condition"],
]
story.append(make_table(terms_data, col_widths=[4*cm, 13*cm]))
story.append(spacer(6))
story.append(mnemonic('"Gene Hunters Have Absolutely Perfect Genuine Dedication" -> G-ene, H-eredity, H-omozygous, A-llele, P-henotype, G-enotype, D-ominant'))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 1: MENDEL
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 1: Mendel and His Experiments")

story += h_sub("Why Mendel Succeeded")
for t in [
    "Chose <b>pea plant (Pisum sativum)</b> - short life cycle, easy to grow, large offspring",
    "Studied <b>7 pairs of contrasting characters</b> one at a time",
    "Used <b>statistics and mathematics</b> - a new approach in biology",
    "Maintained <b>large sample sizes</b> to reduce error",
]:
    story.append(bullet(t))

story.append(spacer(6))
story += h_sub("Mendel's 7 Characters in Pea Plant")

chars_data = [
    ["Character", "Dominant Trait", "Recessive Trait"],
    ["Stem height", "Tall (T)", "Dwarf (t)"],
    ["Seed shape", "Round (R)", "Wrinkled (r)"],
    ["Seed colour", "Yellow (Y)", "Green (y)"],
    ["Pod shape", "Inflated (I)", "Constricted (i)"],
    ["Pod colour", "Green (G)", "Yellow (g)"],
    ["Flower position", "Axial (A)", "Terminal (a)"],
    ["Flower colour", "Violet (V)", "White (v)"],
]
story.append(make_table(chars_data, col_widths=[5*cm, 6*cm, 6*cm]))
story.append(spacer(4))
story.append(mnemonic('"The Silly Yellow Pigs Go Around Villages" -> T-all, S-hape(seed), Y-ellow, P-od(shape), G-reen(pod), A-xial, V-iolet'))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 2: MENDEL'S LAWS
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 2: Mendel's Laws of Inheritance")

story += h_sub("Law 1 - Law of Dominance")
for t in [
    "Characters are controlled by <b>discrete units called factors (genes)</b>",
    "Factors occur <b>in pairs</b>",
    "In a heterozygous pair, one factor <b>dominates</b> the other",
    "Dominant allele expresses itself; recessive stays hidden",
]:
    story.append(bullet(t))

story.append(spacer(6))
story += h_sub("Law 2 - Law of Segregation")
story.append(body('<i>"During gamete formation, the two alleles of a character pair in parents segregate so that a gamete receives only ONE of the two alleles."</i>'))
story.append(spacer(4))
story += h_sub("Monohybrid Cross: TT x tt")

mono_table = punnett_table(
    col_headers=["T", "t"],
    row_headers=["T", "t"],
    cells=[["TT (Tall)", "Tt (Tall)"],
           ["Tt (Tall)", "tt (Dwarf)"]],
)
story.append(mono_table)
story.append(spacer(4))

ratios_mono = [
    ["Ratio Type", "F1", "F2"],
    ["Phenotypic", "All Tall", "3 Tall : 1 Dwarf (3:1)"],
    ["Genotypic", "All Tt", "1 TT : 2 Tt : 1 tt (1:2:1)"],
]
story.append(make_table(ratios_mono, col_widths=[4*cm, 5.5*cm, 7.5*cm], header_bg=GREEN))
story.append(spacer(4))
story.append(mnemonic('"3 for Show, 1 Below" -> phenotypic 3:1. "1-2-1 is genotype fun"'))

story.append(spacer(6))
story += h_sub("Test Cross")
for t in [
    "Cross unknown genotype with <b>homozygous recessive (tt)</b>",
    "All offspring tall -> unknown parent was TT",
    "50% tall, 50% dwarf -> unknown parent was Tt",
]:
    story.append(bullet(t))

story.append(spacer(6))
story += h_sub("Law 3 - Law of Independent Assortment")
story.append(body('<i>"When two or more pairs of characters are inherited together, the segregation of one pair is independent of the segregation of the other pair."</i>'))
story.append(spacer(4))
story += h_sub("Dihybrid Cross: RRYY x rryy")

di_table = punnett_table(
    col_headers=["RY", "Ry", "rY", "ry"],
    row_headers=["RY", "Ry", "rY", "ry"],
    cells=[
        ["RRYY", "RRYy", "RrYY", "RrYy"],
        ["RRYy", "RRyy", "RrYy", "Rryy"],
        ["RrYY", "RrYy", "rrYY", "rrYy"],
        ["RrYy", "Rryy", "rrYy", "rryy"],
    ],
)
story.append(di_table)
story.append(spacer(4))

di_ratio = [
    ["Ratio Type", "F2 Result"],
    ["Phenotypic (F2)", "9 Round Yellow : 3 Round Green : 3 Wrinkled Yellow : 1 Wrinkled Green (9:3:3:1)"],
    ["Genotypic (F2)", "1:2:1:2:4:2:1:2:1 (9 genotypic classes)"],
]
story.append(make_table(di_ratio, col_widths=[4.5*cm, 12.5*cm], header_bg=GREEN))
story.append(spacer(4))
story.append(mnemonic('"Nine Three Three One - Big Families Need Love" (9 is biggest, 1 is the loner)'))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 3: DEVIATIONS
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 3: Deviations from Mendelism")

story += h_sub("3A - Incomplete Dominance")
for t in [
    "Neither allele is fully dominant",
    "Heterozygous offspring shows <b>intermediate phenotype</b>",
    "<b>Example:</b> Snapdragon (Antirrhinum) - Red (RR) x White (rr) -> Pink (Rr)",
    "F2 phenotypic ratio = <b>1:2:1</b> (same as genotypic ratio)",
]:
    story.append(bullet(t))

story.append(spacer(4))
inc_punnett = punnett_table(
    col_headers=["R", "r"],
    row_headers=["R", "r"],
    cells=[["RR (Red)", "Rr (Pink)"], ["Rr (Pink)", "rr (White)"]],
)
story.append(inc_punnett)
story.append(spacer(4))
story.append(mnemonic('"Incomplete = 1:2:1 (same as genotype ratio)"'))

story += h_sub("3B - Codominance")
for t in [
    "Both alleles express <b>simultaneously and equally</b> in heterozygous condition",
    "<b>Example:</b> ABO Blood Groups - I<super>A</super> and I<super>B</super> are codominant; i is recessive",
]:
    story.append(bullet(t))

story.append(spacer(6))
story += h_sub("3C - Multiple Alleles + ABO Blood Groups")
for t in [
    "More than two alleles for the same gene exist in a population",
    "An individual can only have 2 alleles at a time",
    "<b>Example:</b> ABO blood group - three alleles: I<super>A</super>, I<super>B</super>, i",
]:
    story.append(bullet(t))

story.append(spacer(4))
blood_data = [
    ["Blood Group (Phenotype)", "Genotype(s)", "Allele relationship"],
    ["A", "I\u1d2aI\u1d2a or I\u1d2ai", "I\u1d2a dominant over i"],
    ["B", "I\u1d2bI\u1d2b or I\u1d2bi", "I\u1d2b dominant over i"],
    ["AB", "I\u1d2aI\u1d2b", "I\u1d2a and I\u1d2b codominant"],
    ["O", "ii", "Recessive"],
]
story.append(make_table(blood_data, col_widths=[4.5*cm, 5*cm, 7.5*cm], header_bg=TEAL))
story.append(spacer(4))
story.append(mnemonic('"A = II or Ii, B = II or Ii, AB = codominant pair, O = ii (double recessive)" -> Remember O is ZERO dominant alleles'))

story.append(spacer(6))
story += h_sub("3D - Pleiotropy")
for t in [
    "<b>One gene controls MANY traits</b>",
    "<b>Example:</b> Seed texture gene in pea also affects starch synthesis",
    "<b>Human example:</b> Phenylketonuria (PKU) - affects skin colour, mental ability, urine odour",
]:
    story.append(bullet(t))
story.append(mnemonic('"PLEIOtropy = PLEnty of effects from ONE gene"'))

story += h_sub("3E - Polygenic Inheritance")
for t in [
    "<b>Many genes control one trait</b> (opposite of pleiotropy)",
    "Shows continuous variation across population",
    "<b>Example:</b> Skin colour, height in humans; grain colour in wheat",
    "More dominant alleles = more extreme phenotype",
]:
    story.append(bullet(t))
story.append(mnemonic('"PolyGENIC = Many GENES, One Trait" (Poly = many)'))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 4: CHROMOSOMAL THEORY
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 4: Chromosomal Theory of Inheritance")
for t in [
    "<b>Sutton and Boveri (1902)</b> proposed chromosomes are carriers of genes",
    "Both chromosomes and Mendelian factors occur in <b>pairs</b>",
    "They separate during <b>gamete formation</b> (meiosis)",
    "Independent assortment of chromosomes = independent assortment of genes",
]:
    story.append(bullet(t))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 5: LINKAGE & CROSSING OVER
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 5: Linkage and Crossing Over")
story += h_sub("Linkage")
for t in [
    "Genes on the <b>same chromosome</b> tend to be inherited <b>together</b>",
    "They do NOT follow the law of independent assortment",
    "<b>Thomas Hunt Morgan</b> worked on <i>Drosophila melanogaster</i> (fruit fly)",
    "Fruit fly advantages: short life cycle, large offspring, many visible mutations",
]:
    story.append(bullet(t))

story += h_sub("Crossing Over")
for t in [
    "<b>Exchange of genetic material</b> between non-sister chromatids of homologous chromosomes",
    "Occurs during <b>Prophase I of Meiosis I</b>",
    "Creates <b>recombinant chromosomes</b> with new gene combinations",
    "<b>Recombination frequency</b> = (Recombinant offspring / Total offspring) x 100",
    "Used to construct <b>genetic maps / linkage maps</b>",
]:
    story.append(bullet(t))
story.append(mnemonic('"Crossing over CROSSES the barrier of linkage to CREATE recombinants"'))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 6: SEX DETERMINATION
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 6: Sex Determination")

sex_data = [
    ["Organism", "Female", "Male", "Who determines sex?"],
    ["Humans", "44 + XX", "44 + XY", "Father (Y-bearing sperm)"],
    ["Birds", "ZW", "ZZ", "Mother (W-bearing egg)"],
    ["Grasshopper", "XX", "XO", "No Y chromosome"],
    ["Honey Bee", "2n (diploid)", "n (haploid)", "Parthenogenesis"],
]
story.append(make_table(sex_data, col_widths=[4*cm, 3.5*cm, 3.5*cm, 6*cm], header_bg=ORANGE))
story.append(spacer(4))
for t in [
    "In humans: <b>females are XX (homogametic)</b>, males are <b>XY (heterogametic)</b>",
    "In birds: <b>females are ZW (heterogametic)</b>, males are <b>ZZ (homogametic)</b>",
    "In honey bees: males (drones) are haploid (from unfertilized eggs); females are diploid",
]:
    story.append(bullet(t))
story.append(mnemonic('"Humans XY Father, Birds ZW Mother, Bees are Lazy (haploid males from eggs)"'))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 7: SEX-LINKED INHERITANCE
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 7: Sex-Linked Inheritance")
story.append(body("Genes located on <b>sex chromosomes</b> show sex-linked inheritance. The X chromosome carries many genes; the Y chromosome carries very few."))

story += h_sub("Haemophilia (X-Linked Recessive)")
for t in [
    "Blood does not clot normally (deficiency of clotting Factor VIII or IX)",
    "Much <b>more common in males</b> (only one X chromosome)",
    "<b>Queen Victoria of England</b> was a famous carrier",
]:
    story.append(bullet(t))

story.append(spacer(4))
haemo_data = [
    ["Genotype", "Sex", "Phenotype"],
    ["X\u1d34X\u1d34", "Female", "Normal"],
    ["X\u1d34X\u02b0", "Female", "Carrier (normal phenotype)"],
    ["X\u02b0X\u02b0", "Female", "Haemophilic"],
    ["X\u1d34Y", "Male", "Normal"],
    ["X\u02b0Y", "Male", "Haemophilic"],
]
story.append(make_table(haemo_data, col_widths=[5*cm, 4*cm, 8*cm], header_bg=RED))
story.append(spacer(4))
story += h_sub("Key Cross: Carrier Female x Normal Male")
story.append(body("X<super>H</super>X<super>h</super> x X<super>H</super>Y -> offspring: X<super>H</super>X<super>H</super> (Normal female), X<super>H</super>X<super>h</super> (Carrier female), X<super>H</super>Y (Normal male), X<super>h</super>Y (Haemophilic male)"))
story.append(body("<b>25% chance of haemophilic son; 50% of sons will be haemophilic</b>"))
story.append(spacer(4))
story += h_sub("Colour Blindness (X-Linked Recessive)")
story.append(body("Same inheritance pattern as haemophilia. Inability to distinguish <b>red and green colours</b>. Males more commonly affected."))
story.append(mnemonic('"Males are MORE LIKELY to show X-linked disorders - only ONE X, no spare copy to rescue them!"'))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 8: MUTATION
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 8: Mutation")
story.append(body("<b>Mutation</b> = A sudden, heritable change in the genetic material (DNA sequence or chromosome number/structure)"))
story.append(spacer(4))
story += h_sub("Types of Mutations")

mut_data = [
    ["Type", "Description", "Example"],
    ["Point / Gene Mutation", "Change in a single base pair of DNA", "Sickle Cell Anaemia: GAG -> GUG (Glu -> Val)"],
    ["Chromosomal Aberration", "Changes in chromosome structure (deletion, duplication, inversion, translocation)", "Various cancers, Down Syndrome"],
    ["Aneuploidy - Trisomy", "2n+1: one extra chromosome", "Down Syndrome (Trisomy 21)"],
    ["Aneuploidy - Monosomy", "2n-1: one chromosome missing", "Turner's Syndrome (45, X)"],
]
story.append(make_table(mut_data, col_widths=[4*cm, 7*cm, 6*cm], header_bg=PURPLE))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 9: PEDIGREE ANALYSIS
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 9: Pedigree Analysis")
story.append(body("A <b>diagrammatic representation</b> of inheritance of a trait across generations in a family. Used to determine inheritance pattern of a trait."))
story.append(spacer(4))

symbols_data = [
    ["Symbol", "Meaning"],
    ["Circle (O)", "Normal female"],
    ["Square ([])", "Normal male"],
    ["Filled circle", "Affected female"],
    ["Filled square", "Affected male"],
    ["Half-filled circle/square", "Carrier female / Carrier male"],
    ["Horizontal line (=)", "Mating / Marriage"],
    ["Vertical line", "Offspring"],
]
story.append(make_table(symbols_data, col_widths=[5*cm, 12*cm], header_bg=TEAL))
story.append(spacer(4))

story += h_sub("Determining Inheritance Pattern")
pattern_data = [
    ["Observation", "Conclusion"],
    ["Trait skips generations", "Recessive"],
    ["Trait in every generation", "Dominant"],
    ["Only males affected", "X-linked recessive likely"],
    ["Affected father has affected sons", "Autosomal (not X-linked)"],
    ["Carrier mothers pass to sons", "X-linked recessive"],
]
story.append(make_table(pattern_data, col_widths=[9*cm, 8*cm], header_bg=GREEN))
story.append(mnemonic('"SKIP = Recessive, EVERY GEN = Dominant, ONLY MALES = X-linked"'))

# ═══════════════════════════════════════════════════════════════════
# TOPIC 10: GENETIC DISORDERS
# ═══════════════════════════════════════════════════════════════════
story += h_topic("TOPIC 10: Genetic Disorders")

story += h_sub("A. Chromosomal Disorders")
story.append(spacer(3))

chrom_data = [
    ["Feature", "Down Syndrome", "Klinefelter's Syndrome", "Turner's Syndrome"],
    ["Chromosome No.", "47 (Trisomy 21)", "47 (XXY)", "45 (XO)"],
    ["Type", "Autosomal trisomy", "Sex chromosome", "Sex chromosome monosomy"],
    ["Sex", "Male / Female", "Male", "Female"],
    ["Key Features", "Mental retardation, short stature, furrowed tongue, broad palm", "Gynaecomastia, sterile", "Webbed neck, short, rudimentary ovaries, sterile"],
    ["Fertility", "Reduced", "Sterile", "Sterile"],
    ["Extra Notes", "Risk increases with maternal age", "Develops breasts (male)", "No secondary sexual characters"],
]
story.append(make_table(chrom_data, col_widths=[3.5*cm, 4.5*cm, 4.5*cm, 4.5*cm], header_bg=ORANGE, font_size=8))
story.append(spacer(4))
story.append(mnemonic('"Down\'s goes to 21 (Trisomy 21), Kline has EXTRA X makes male BREASTS, Turner has ONLY ONE X with webbed neck"'))

story.append(spacer(6))
story += h_sub("B. Mendelian / Gene Disorders")
story.append(spacer(3))

gene_data = [
    ["Disorder", "Inheritance", "Cause", "Key Feature"],
    ["Sickle Cell Anaemia", "Autosomal Recessive", "GAG->GUG mutation in beta-globin gene; Glu->Val; HbS forms fibres", "Sickle-shaped RBCs; carriers resistant to malaria"],
    ["Phenylketonuria (PKU)", "Autosomal Recessive", "Deficiency of phenylalanine hydroxylase; Phe accumulates", "Mental retardation, light skin, musty odour (pleiotropy example)"],
    ["Thalassemia", "Autosomal Recessive", "Reduced synthesis of alpha or beta globin chains (NOT structural change)", "Anaemia; quantitative deficiency of Hb chains"],
]
story.append(make_table(gene_data, col_widths=[3.5*cm, 3.5*cm, 6*cm, 4*cm], header_bg=RED, font_size=8))
story.append(spacer(4))
story.append(note("Key distinction: Sickle Cell = STRUCTURAL change in Hb (wrong amino acid); Thalassemia = QUANTITATIVE reduction (less Hb made)"))
story.append(mnemonic('"SiPhThal" - Si(ckle cell), Ph(enylketonuria), Thal(assemia) - ALL autosomal recessive!'))

# ═══════════════════════════════════════════════════════════════════
# MASTER RATIO SUMMARY
# ═══════════════════════════════════════════════════════════════════
story += h_chapter("MASTER RATIO QUICK REFERENCE")
story.append(spacer(4))

ratio_data = [
    ["Cross Type", "F2 Phenotypic Ratio", "F2 Genotypic Ratio"],
    ["Monohybrid", "3:1", "1:2:1"],
    ["Dihybrid", "9:3:3:1", "1:2:1:2:4:2:1:2:1"],
    ["Incomplete Dominance", "1:2:1", "1:2:1"],
    ["Test Cross (Tt x tt)", "1:1", "1:1"],
    ["Codominance (AB blood)", "Equal expression of both alleles", "I\u1d2aI\u1d2b"],
]
story.append(make_table(ratio_data, col_widths=[5*cm, 7*cm, 5*cm], header_bg=DARK_BLUE))
story.append(spacer(4))
story.append(mnemonic('"Mono is 3:1 | Di is 9:3:3:1 | Incomplete flips to 1:2:1 | Test gives 1:1" - say it like a chant!'))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
# MCQs
# ═══════════════════════════════════════════════════════════════════
story += h_chapter("3 CHALLENGING MCQs - Test Your Recall!")
story.append(spacer(6))

story.append(Paragraph("Attempt all questions before checking the answer key at the bottom.", note_style))
story.append(spacer(8))

# Q1
story.append(Paragraph("Q1. In a cross between a carrier female for haemophilia (X<super>H</super>X<super>h</super>) and a normal male (X<super>H</super>Y), what is the probability that a SON born will have haemophilia?", mcq_q_style))
for opt in ["(A) 25%", "(B) 50%", "(C) 100%", "(D) 0%"]:
    story.append(Paragraph(opt, mcq_opt_style))
story.append(spacer(8))

# Q2
story.append(Paragraph("Q2. A man with blood group A (genotype I<super>A</super>i) marries a woman with blood group B (genotype I<super>B</super>i). Which of the following blood groups is NOT possible in their children?", mcq_q_style))
for opt in ["(A) Blood group A", "(B) Blood group O", "(C) Blood group AB", "(D) All of the above are possible"]:
    story.append(Paragraph(opt, mcq_opt_style))
story.append(spacer(8))

# Q3
story.append(Paragraph("Q3. In snapdragon (Antirrhinum), a red-flowered plant (RR) is crossed with a white-flowered plant (rr). The F1 plants (Rr) are self-pollinated. What will be the phenotypic ratio in F2?", mcq_q_style))
for opt in ["(A) 3 Red : 1 White", "(B) 1 Red : 2 Pink : 1 White", "(C) 1 Red : 1 White", "(D) All Red"]:
    story.append(Paragraph(opt, mcq_opt_style))

story.append(spacer(30))
story.append(HRFlowable(width="100%", thickness=1, color=DARK_BLUE))
story.append(spacer(10))
story.append(Paragraph("ANSWER KEY", make_style("AKH", fontSize=11, fontName="Helvetica-Bold", textColor=DARK_BLUE)))
story.append(spacer(6))

ans_data = [
    ["Q", "Answer", "Explanation"],
    ["1", "B - 50%", "Cross: X\u1d34X\u02b0 x X\u1d34Y gives X\u1d34X\u1d34, X\u1d34X\u02b0, X\u1d34Y, X\u02b0Y. Among sons (X\u1d34Y and X\u02b0Y), 1 in 2 = 50% are haemophilic."],
    ["2", "D - All possible", "I\u1d2ai x I\u1d2bi gives I\u1d2aI\u1d2b (AB), I\u1d2ai (A), I\u1d2bi (B), ii (O). All 4 blood groups are possible. Classic trap!"],
    ["3", "B - 1:2:1", "Incomplete dominance. F2 = 1 RR (Red) : 2 Rr (Pink) : 1 rr (White). Phenotypic ratio = genotypic ratio = 1:2:1."],
]
story.append(make_table(ans_data, col_widths=[1*cm, 3.5*cm, 12.5*cm], header_bg=GREEN))

story.append(spacer(16))
story.append(Paragraph("Pro Tip for Boards: Punnett squares, chromosomal disorder tables, and blood group crosses are very high yield. Practice drawing the 4x4 dihybrid Punnett square from memory!", note_style))
story.append(spacer(6))
story.append(Paragraph("- Notes compiled as per NCERT Class 12 Biology Chapter 4 | CBSE 2026-27 -",
    make_style("Footer", fontSize=8, fontName="Helvetica-Oblique", textColor=colors.grey, alignment=TA_CENTER)))

# ── Build doc ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=1.8*cm, leftMargin=1.8*cm,
    topMargin=2*cm, bottomMargin=2*cm,
    title="Ch4 Principles of Inheritance and Variation - NCERT Class 12",
    author="Orris Biology Tutor",
)
doc.build(story)
print("PDF created:", OUTPUT)
Running Command

python /home/daytona/workspace/bio-ch4-notes/generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/bio-ch4-notes/

Your PDF is ready! Here's your download link:

Ch4 Inheritance Variation Notes

PDF Document Β· PDF

What's inside the PDF:
  • Cover page with chapter title and syllabus tag
  • All 10 topics fully covered with colored section headers
  • Properly formatted Punnett squares (monohybrid + dihybrid)
  • Color-coded comparison tables (chromosomal disorders, blood groups, sex determination, etc.)
  • All mnemonics highlighted in yellow
  • Important notes in green callout boxes
  • Master Ratio Quick Reference table
  • 3 MCQs with answer key at the end
  • Fully CBSE 2026-27 aligned
This is a shared conversation. Sign in to Orris to start your own chat.