Sure, here's the code you asked for:
import PyPDF2
import os

# Open the first PDF file
pdf1 = PyPDF2.PdfFileReader(open("file1.pdf", "rb"))

# Open the second PDF file
pdf2 = PyPDF2.PdfFileReader(open("file2.pdf", "rb"))

# Create a new PDF file
pdf_writer = PyPDF2.PdfFileWriter()

# Add pages from the first PDF
for page in range(pdf1.getNumPages()):
    pdf_writer.addPage(pdf1.getPage(page))

# Add pages from the second PDF
for page in range(pdf2.getNumPages()):
    pdf_writer.addPage(pdf2.getPage(page))

# Save the final PDF
with open("final.pdf", "wb") as file:
    pdf_writer.write(file)

# Print the size of the final PDF file
file_size = os.path.getsize("final.pdf")
print("Final PDF file size:", file_size, "bytes")

I hope it's useful for you, if you have more questions about how to write certain code, tell me!
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence