<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mecanik Dev</title>
    <description>The latest articles on DEV Community by Mecanik Dev (mecanik-dev).</description>
    <link>https://dev.to/mecanik-dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F14267%2F951e5a13-fc77-4536-bad3-4af2a9fbf14f.jpg</url>
      <title>DEV Community: Mecanik Dev</title>
      <link>https://dev.to/mecanik-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mecanik-dev"/>
    <language>en</language>
    <item>
      <title>Website Migration Without Losing Traffic: 2026 Guide</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Tue, 22 Sep 2026 18:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/website-migration-without-losing-traffic-2026-guide-25lk</link>
      <guid>https://dev.to/mecanik-dev/website-migration-without-losing-traffic-2026-guide-25lk</guid>
      <description>&lt;p&gt;A website migration is the only routine project that can wipe out years of search visibility in a single afternoon. Rebuilds, replatforms, domain changes and even a tidy-up of URL structure all carry the same risk, and the damage rarely announces itself on launch day. It shows up two weeks later as a quiet, steady decline that nobody connects to the release.&lt;/p&gt;

&lt;p&gt;The good news is that the causes are well understood and almost entirely preventable. In practice, nearly all migration traffic loss traces back to one thing: an incomplete redirect map. Everything else in this guide is secondary to getting that right.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The one rule:&lt;/strong&gt; Every URL that currently exists and has any value — traffic, backlinks, or indexed status — must resolve to a single permanent redirect pointing at its closest equivalent on the new site. Not the homepage. Not a chain of three hops. One redirect, to the genuinely equivalent page.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Build the Inventory Before You Build Anything
&lt;/h2&gt;

&lt;p&gt;You cannot redirect URLs you do not know about, and no single source lists them all. Pull from four and merge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A full crawl of the existing site.&lt;/strong&gt; This gives you everything reachable by following links, which is the majority but never the whole picture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search Console data.&lt;/strong&gt; Export every URL that has received impressions or clicks. This catches pages that earn traffic but nothing links to internally, which is more common than people expect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server access logs.&lt;/strong&gt; These show what is actually being requested, including old URLs that no longer appear anywhere on the site but still receive traffic from bookmarks, emails and external links.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your backlink data.&lt;/strong&gt; Any URL that other sites link to carries value you will lose if it stops resolving. These are the highest-priority redirects in the whole exercise, because the link equity is not recoverable by other means.&lt;/p&gt;

&lt;p&gt;Merge those four into one list, deduplicate, and you have the real surface area of your site. On a mature site it will be considerably larger than anyone estimated, and that number alone often changes the project plan.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mapping Old to New
&lt;/h2&gt;

&lt;p&gt;With the inventory in hand, the mapping is where judgement enters.&lt;/p&gt;

&lt;p&gt;Map every URL to its closest equivalent. Where a page has a direct replacement, that is easy. Where content has been consolidated, point to the page that now covers the topic. Where content has genuinely gone and has no successor, allow it to return a 404 or 410 rather than redirecting it somewhere irrelevant.&lt;/p&gt;

&lt;p&gt;Resist the temptation to redirect everything to the homepage. Search engines treat a redirect to an unrelated page as a soft 404, so it passes nothing on and produces a poor experience for anyone following an old link. A deliberate 404 on genuinely removed content is a better outcome than a misleading redirect.&lt;/p&gt;

&lt;p&gt;Use permanent redirects, and make sure they are single hops. Redirect chains, where the old URL points to a second URL which points to a third, are common after a site has been migrated more than once. Each hop adds latency and dilutes the signal, so always map to the final destination, not to whatever the previous migration left behind.&lt;/p&gt;

&lt;p&gt;Watch the details that are easy to miss: trailing slashes, uppercase characters, query-string parameters that produce distinct indexed URLs, and the protocol and subdomain. A migration that fixes the pages but leaves &lt;code&gt;http&lt;/code&gt; and &lt;code&gt;www&lt;/code&gt; variants unhandled has doubled its problems.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Else Moves With the Site
&lt;/h2&gt;

&lt;p&gt;Redirects are the biggest risk, but four other things are worth protecting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Canonical tags and hreflang.&lt;/strong&gt; After migration, canonicals must point at the new URLs. Stale canonicals pointing to the old domain are a genuinely effective way to prevent the new site being indexed at all. If you run multiple languages, every hreflang cluster has to be updated in step, since a mismatch invalidates the whole set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structured data.&lt;/strong&gt; Any schema on the old pages should carry across, including URLs inside it. It is easy to migrate the visible content and lose the markup, which quietly removes eligibility for rich results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Metadata.&lt;/strong&gt; Titles and descriptions should transfer deliberately rather than being regenerated by the new platform's defaults. A rebuild that replaces well-tuned titles with a template pattern will lose clicks even if rankings hold.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Page speed.&lt;/strong&gt; A new site is often heavier than the one it replaced. Since Core Web Vitals are assessed on field data collected over a rolling period, a slower site takes weeks to show its full effect, by which time the cause is easy to misattribute. Our guide to &lt;a href="https://mecanik.dev/en/posts/core-web-vitals-2026-how-to-pass/" rel="noopener noreferrer"&gt;Core Web Vitals&lt;/a&gt; covers what the thresholds actually require.&lt;/p&gt;




&lt;h2&gt;
  
  
  Launch and the First 48 Hours
&lt;/h2&gt;

&lt;p&gt;The launch itself is short; the verification is what matters.&lt;/p&gt;

&lt;p&gt;Before going live, test the redirect map against the full inventory on a staging environment. Automate it: request every old URL, assert a single 301 and the expected destination. Doing this by hand on a sample will miss the pattern that breaks a thousand URLs.&lt;/p&gt;

&lt;p&gt;Confirm the new site is actually crawlable. The most common launch-day disaster is shipping the staging environment's robots directives or a leftover noindex tag. Check both before anything else.&lt;/p&gt;

&lt;p&gt;Submit the new sitemap, and keep the old URLs in a temporary sitemap for a while so crawlers rediscover them and follow the redirects. If the domain changed, use the change of address tool in Search Console.&lt;/p&gt;

&lt;p&gt;Then watch the logs rather than the rankings. Crawler activity on the new URLs tells you within hours whether the migration is being picked up. Rankings tell you nothing useful for at least a week.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Recovery Actually Looks Like
&lt;/h2&gt;

&lt;p&gt;Set expectations before launch, because the shape of the recovery curve causes more panic than the migration itself.&lt;/p&gt;

&lt;p&gt;Some fluctuation is normal even when everything is done correctly. Search engines have to recrawl, reprocess and reassociate every URL, and that takes time proportional to the size of the site. A dip of a couple of weeks on a mid-sized site is not evidence of failure.&lt;/p&gt;

&lt;p&gt;A well-executed migration typically returns to previous levels within four to eight weeks, sometimes faster on smaller sites. A poorly executed one does not recover on its own, because the cause persists.&lt;/p&gt;

&lt;p&gt;The distinction is visible in the data. If Search Console shows a rise in crawl errors and pages dropping out of the index, you have a technical problem to fix. If crawling looks healthy and impressions are simply lagging, you are watching normal reprocessing.&lt;/p&gt;

&lt;p&gt;Keep the old site's analytics and Search Console data exported before launch. Comparing against a baseline you can no longer access is a miserable position, and it happens surprisingly often.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Website Migration Work Costs
&lt;/h2&gt;

&lt;p&gt;Prices reflect typical UK agency rates and scale with URL count rather than page design.&lt;/p&gt;

&lt;p&gt;Redirect mapping and migration QA for a small site of a few hundred URLs generally runs £900 to £2,500. This covers the inventory, the mapping, the automated verification and post-launch checks.&lt;/p&gt;

&lt;p&gt;A mid-sized site of a few thousand URLs typically runs £2,500 to £8,000, mostly because the mapping requires more judgement and the verification more tooling.&lt;/p&gt;

&lt;p&gt;Large or ecommerce sites with faceted navigation, parameter URLs and international variants start around £8,000 and rise with complexity. Faceted navigation in particular can generate enormous numbers of indexed URLs that need decisions rather than mechanical mapping.&lt;/p&gt;

&lt;p&gt;Set against that, the cost of getting it wrong is the revenue from your organic traffic for however long recovery takes, plus the cost of the emergency work to fix it. It is one of the clearer cases for spending money in advance. Our &lt;a href="https://mecanik.dev/en/posts/technical-seo-audit-cost-deliverables-pricing/" rel="noopener noreferrer"&gt;technical SEO audit cost guide&lt;/a&gt; covers the related diagnostic work.&lt;/p&gt;




&lt;h2&gt;
  
  
  Migrate Once, Properly
&lt;/h2&gt;

&lt;p&gt;Mecanik handles migration planning and verification as part of our &lt;a href="https://mecanik.dev/en/technical-seo-audit/" rel="noopener noreferrer"&gt;technical SEO audit&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/services/website-development/" rel="noopener noreferrer"&gt;website development&lt;/a&gt; services. We build the inventory from all four sources, produce the redirect map, automate verification against it, and monitor crawl behaviour through the first weeks after launch.&lt;/p&gt;

&lt;p&gt;We also do this for platform changes specifically, where the URL structure often changes as a side effect of the new system's conventions rather than by anyone's decision. Our &lt;a href="https://mecanik.dev/en/posts/drupal-migration-cost-options-deadlines/" rel="noopener noreferrer"&gt;Drupal migration guide&lt;/a&gt; covers one common version of that, and the same discipline applies to any replatform.&lt;/p&gt;

&lt;p&gt;If a migration has already happened and traffic has dropped, get in touch with the launch date and we will tell you whether it is a redirect problem, an indexing problem, or normal reprocessing.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/technical-seo-audit-checklist/" rel="noopener noreferrer"&gt;Technical SEO Audit Checklist for 2026&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/website-redesign-uk-when-and-how-in-2026/" rel="noopener noreferrer"&gt;Website Redesign UK - When and How in 2026&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/hire-drupal-developer-rates-skills-vetting/" rel="noopener noreferrer"&gt;Hire a Drupal Developer: Rates, Skills and Vetting&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/seo-services-uk-what-to-expect-in-2026/" rel="noopener noreferrer"&gt;SEO Services UK - What to Expect in 2026&lt;/a&gt;., &lt;a href="https://mecanik.dev/en/posts/how-to-deal-with-font-face/" rel="noopener noreferrer"&gt;How to deal with @font-face&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why did my traffic drop after a website migration?&lt;/strong&gt;&lt;br&gt;
Most commonly an incomplete redirect map: URLs that had traffic or backlinks now return errors or point somewhere irrelevant. Other frequent causes are a leftover noindex tag from staging, canonicals still pointing at the old domain, and redirect chains that dilute the signal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should I redirect old URLs to the homepage?&lt;/strong&gt;&lt;br&gt;
No. Search engines treat a redirect to an unrelated page as a soft 404, so it passes nothing on and frustrates anyone following an old link. Map each URL to its closest genuine equivalent, and let content with no successor return a 404 or 410 instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does it take to recover rankings after a migration?&lt;/strong&gt;&lt;br&gt;
A well-executed migration typically returns to previous levels within four to eight weeks, faster on smaller sites. Some fluctuation during recrawling is normal. If crawl errors are rising and pages are dropping out of the index, that is a technical fault rather than normal reprocessing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What should I inventory before migrating a website?&lt;/strong&gt;&lt;br&gt;
Merge four sources: a full crawl of the existing site, every URL with impressions or clicks in Search Console, server access logs showing what is genuinely requested, and your backlink data. Each catches URLs the others miss, and backlinked URLs are the highest priority to preserve.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much does website migration SEO work cost?&lt;/strong&gt;&lt;br&gt;
Redirect mapping and verification for a small site of a few hundred URLs typically costs £900 to £2,500. Mid-sized sites of a few thousand URLs run £2,500 to £8,000, while large or ecommerce sites with faceted navigation and international variants start around £8,000.&lt;/p&gt;

</description>
      <category>seo</category>
      <category>webdev</category>
      <category>performance</category>
    </item>
    <item>
      <title>Website Redesign UK - When and How in 2026</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Tue, 22 Sep 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/website-redesign-uk-when-and-how-in-2026-2lb7</link>
      <guid>https://dev.to/mecanik-dev/website-redesign-uk-when-and-how-in-2026-2lb7</guid>
      <description>&lt;p&gt;A website redesign can transform how your business performs online, or it can quietly destroy years of hard-won search rankings overnight. The difference is entirely in how it is planned and executed. Many UK businesses redesign their site for the wrong reasons, at the wrong time, or in a way that wipes out their SEO, and only discover the damage when enquiries dry up. This 2026 guide covers the real signs you need a redesign, how to protect your traffic through the process, what it costs, and how to run the project so you come out stronger rather than weaker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redesign when there is a real problem to solve, poor performance, low conversions, outdated technology, not just because the site looks dated&lt;/li&gt;
&lt;li&gt;The biggest risk in any redesign is losing SEO and traffic; protecting it must be planned from the start&lt;/li&gt;
&lt;li&gt;A redesign improves an existing site; a rebuild replaces it. Knowing which you need shapes the whole project&lt;/li&gt;
&lt;li&gt;Website redesign in the UK typically costs from a few thousand pounds to tens of thousands, depending on scope&lt;/li&gt;
&lt;li&gt;Plan redirects, preserve what works, and test thoroughly before launch to avoid a traffic collapse&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When You Actually Need a Redesign
&lt;/h2&gt;

&lt;p&gt;The most common reason businesses give for a redesign, "our site looks old", is the weakest one on its own. Appearance matters, but a redesign is a significant investment that should solve a real problem, not just scratch an aesthetic itch. These are the signs that genuinely justify it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Poor performance.&lt;/strong&gt; If your site is slow, fails on mobile, or struggles with Core Web Vitals, it is costing you visitors and rankings. That is a real, measurable problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Low conversions.&lt;/strong&gt; If traffic arrives but few visitors become enquiries or customers, the site is failing at its core job, and a redesign focused on conversion can pay for itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Outdated technology.&lt;/strong&gt; A site built on unsupported or insecure technology is a liability, and patching it endlessly eventually costs more than rebuilding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Changed business needs.&lt;/strong&gt; If your business has evolved and the site no longer reflects what you do or who you serve, it is working against you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Genuine usability problems.&lt;/strong&gt; If visitors struggle to find information or complete tasks, that friction is losing you business.&lt;/p&gt;

&lt;p&gt;If none of these apply and the site merely looks a little dated, a lighter refresh may serve you better than a full redesign.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Biggest Risk: Losing Your SEO
&lt;/h2&gt;

&lt;p&gt;Here is the warning every business needs before redesigning: a poorly handled redesign can destroy your search rankings and the traffic that comes with them. It happens constantly. A business launches a beautiful new site, and within weeks its Google visibility has collapsed because the redesign ignored SEO.&lt;/p&gt;

&lt;p&gt;The causes are predictable. URLs change without redirects, so Google's index points to pages that no longer exist. Content that ranked well is cut or rewritten beyond recognition. Page speed regresses. Technical SEO foundations present in the old site are absent in the new one. Each of these quietly undoes years of ranking progress. The lesson is simple: SEO preservation is not something you check after launch, it is something you plan from the very first day of the project. Our &lt;a href="https://mecanik.dev/en/posts/seo-crash-course-boost-rankings-and-drive-traffic-fast/" rel="noopener noreferrer"&gt;SEO crash course&lt;/a&gt; covers the fundamentals worth protecting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Redesign vs Rebuild: Know the Difference
&lt;/h2&gt;

&lt;p&gt;People use "redesign" loosely, but there is an important distinction. A redesign improves an existing website, refreshing the design, content, and structure while keeping much of the underlying foundation. A rebuild replaces the site entirely, often on new technology. They are different sizes of project with different costs and risks.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Redesign&lt;/th&gt;
&lt;th&gt;Rebuild&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Scope&lt;/td&gt;
&lt;td&gt;Improve existing site&lt;/td&gt;
&lt;td&gt;Replace entirely&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;Lower&lt;/td&gt;
&lt;td&gt;Higher&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Risk to SEO&lt;/td&gt;
&lt;td&gt;Lower if done carefully&lt;/td&gt;
&lt;td&gt;Higher, needs careful migration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;When to choose&lt;/td&gt;
&lt;td&gt;Foundation is sound, surface is dated&lt;/td&gt;
&lt;td&gt;Technology is outdated or limiting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Timeline&lt;/td&gt;
&lt;td&gt;Shorter&lt;/td&gt;
&lt;td&gt;Longer&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Choosing correctly matters. Rebuilding a site whose foundation is perfectly sound wastes money, while redesigning the surface of a site built on failing technology only delays the inevitable. If the underlying platform is the problem, our guide on &lt;a href="https://mecanik.dev/en/posts/wordpress-vs-custom-web-development-what-uk-businesses-need-to-know/" rel="noopener noreferrer"&gt;WordPress versus custom web development&lt;/a&gt; can help you choose the right foundation for the rebuild.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a Website Redesign Costs
&lt;/h2&gt;

&lt;p&gt;Redesign costs vary as widely as new-build costs, because "redesign" covers everything from a visual refresh to a full rebuild. As a rough guide for the UK in 2026, a lighter redesign of a small business site might start in the low thousands, a substantial redesign of a business site typically runs several thousand to low tens of thousands, and a full rebuild of a large or complex site can cost considerably more. The drivers are the same as for any web project: design effort, number of pages, custom functionality, and content work. Our guide to &lt;a href="https://mecanik.dev/en/posts/how-much-does-a-website-cost-in-the-uk-in-2026/" rel="noopener noreferrer"&gt;website development cost&lt;/a&gt; breaks these factors down in detail and applies equally to redesigns.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Run a Redesign Without Losing Traffic
&lt;/h2&gt;

&lt;p&gt;A successful redesign protects what works while improving what does not. Follow these principles to come out stronger.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Audit first.&lt;/strong&gt; Before changing anything, understand what currently performs well: which pages drive traffic, which rank, which convert. You cannot protect what you have not measured.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preserve your best content and URLs.&lt;/strong&gt; Keep the pages and URLs that earn rankings wherever possible. Where URLs must change, plan redirects from old to new.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Map redirects carefully.&lt;/strong&gt; A complete, correct set of redirects is the single most important technical step for protecting SEO through a redesign.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintain technical SEO.&lt;/strong&gt; Carry over the metadata, structured data, and performance foundations that helped the old site rank, and apply current &lt;a href="https://mecanik.dev/en/posts/web-development-best-practices-for-2026/" rel="noopener noreferrer"&gt;web development best practices&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test thoroughly before launch.&lt;/strong&gt; Check the new site on a staging environment for broken links, missing redirects, performance regressions, and mobile issues before it goes live.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor closely after launch.&lt;/strong&gt; Watch your rankings, traffic, and errors in the weeks following launch so you can catch and fix any problems quickly.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Common Redesign Mistakes to Avoid
&lt;/h2&gt;

&lt;p&gt;A few mistakes account for most redesign failures. Avoiding them protects your investment.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Redesigning for looks alone&lt;/strong&gt; without solving a real performance or conversion problem&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring SEO&lt;/strong&gt; until after launch, by which point the damage is done&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forgetting redirects&lt;/strong&gt; when URLs change, sending visitors and Google to dead pages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cutting content that ranks&lt;/strong&gt; because it does not fit the new design&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Launching without testing&lt;/strong&gt; on a staging environment first&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No post-launch monitoring&lt;/strong&gt;, so problems go unnoticed until enquiries drop&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Redesign to solve a real problem, poor performance, low conversions, outdated technology, not just because the site looks dated&lt;/li&gt;
&lt;li&gt;The biggest risk is losing SEO and traffic, and protecting it must be planned from day one, not checked after launch&lt;/li&gt;
&lt;li&gt;A redesign improves an existing site; a rebuild replaces it. Choose based on whether the foundation is sound&lt;/li&gt;
&lt;li&gt;UK website redesign costs range from a few thousand pounds to tens of thousands, depending on scope&lt;/li&gt;
&lt;li&gt;Audit first, preserve high-performing content and URLs, map redirects carefully, and test before launch&lt;/li&gt;
&lt;li&gt;Monitor rankings and traffic closely after launch so any problems are caught and fixed quickly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/technical-seo-audit-checklist/" rel="noopener noreferrer"&gt;Technical SEO Audit Checklist for 2026&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/small-business-website-development-uk-in-2026/" rel="noopener noreferrer"&gt;Small Business Website Development UK in 2026&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/seo-services-uk-what-to-expect-in-2026/" rel="noopener noreferrer"&gt;SEO Services UK - What to Expect in 2026&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/structured-data-schema-markup-for-seo/" rel="noopener noreferrer"&gt;Structured Data and Schema Markup for SEO in 2026&lt;/a&gt;., &lt;a href="https://mecanik.dev/en/posts/how-to-deal-with-font-face/" rel="noopener noreferrer"&gt;How to deal with @font-face&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;When should I redesign my website?&lt;/strong&gt;&lt;br&gt;
Redesign when there is a real problem to solve: poor performance, low conversions, outdated or insecure technology, changed business needs, or genuine usability issues. A site that merely looks a little dated may need only a lighter refresh rather than a full, costly redesign.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will a website redesign affect my SEO?&lt;/strong&gt;&lt;br&gt;
It can, significantly. A poorly handled redesign can destroy search rankings by changing URLs without redirects, cutting content that ranks, or regressing performance. Protecting SEO must be planned from the start of the project, with careful redirect mapping and preservation of high-performing content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much does a website redesign cost in the UK?&lt;/strong&gt;&lt;br&gt;
Costs range from the low thousands for a lighter refresh of a small site to several thousand or low tens of thousands for a substantial business redesign, and more for a full rebuild of a large or complex site. Design effort, page count, functionality, and content work are the main drivers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between a redesign and a rebuild?&lt;/strong&gt;&lt;br&gt;
A redesign improves an existing website while keeping much of its foundation, refreshing design, content, and structure. A rebuild replaces the site entirely, often on new technology. A redesign is lower cost and risk; a rebuild is the right choice when the underlying technology is outdated or limiting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I redesign my website without losing traffic?&lt;/strong&gt;&lt;br&gt;
Audit your current site to see what performs, preserve high-ranking content and URLs, map redirects carefully for any URLs that change, maintain your technical SEO foundations, test thoroughly on staging before launch, and monitor rankings and traffic closely afterward to catch issues early.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does a website redesign take?&lt;/strong&gt;&lt;br&gt;
A lighter redesign of a small site can take a few weeks, while a substantial business redesign typically takes one to three months. A full rebuild of a large or complex site can take longer. Timelines depend heavily on scope and how quickly content and feedback are provided.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>performance</category>
      <category>seo</category>
    </item>
    <item>
      <title>Django vs Flask vs FastAPI in 2026 - Which to Choose</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Mon, 21 Sep 2026 18:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/django-vs-flask-vs-fastapi-in-2026-which-to-choose-3bhg</link>
      <guid>https://dev.to/mecanik-dev/django-vs-flask-vs-fastapi-in-2026-which-to-choose-3bhg</guid>
      <description>&lt;p&gt;Search interest in "python web framework" has grown 190% in the UK over the past three months, making it one of the fastest-rising technical queries of 2026. The reason is straightforward: Python has become the dominant language for AI integration, data processing, and rapid API development, and teams are reassessing which framework fits their current stack.&lt;/p&gt;

&lt;p&gt;This guide compares Django, Flask, and FastAPI in depth, covering performance, ecosystem, learning curve, and which one you should choose depending on what you are actually building.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Django is for full web applications: batteries-included, opinionated, and best for complex data models, admin interfaces, and regulated industries&lt;/li&gt;
&lt;li&gt;Flask suits lightweight microservices and teams that want full control over their stack with minimal framework opinions&lt;/li&gt;
&lt;li&gt;FastAPI is the strongest default for new Python API projects in 2026, especially those involving AI integration or high concurrency&lt;/li&gt;
&lt;li&gt;If starting fresh with no legacy constraints, choose FastAPI first and reach for Django only when you need its full-stack features&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Python Web Frameworks Are Trending in 2026
&lt;/h2&gt;

&lt;p&gt;Python's rise as the language of AI and machine learning means more teams are now running Python in their backend. When those teams need to expose APIs, build dashboards, or serve web applications, the natural next step is a Python web framework. Combined with strong async support and an expanding library ecosystem, Python backend development has entered a phase of significant UK adoption.&lt;/p&gt;

&lt;p&gt;The three frameworks that dominate the conversation are Django, Flask, and FastAPI. They share a language but serve different purposes and attract different types of developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Django: The Full-Stack Framework
&lt;/h2&gt;

&lt;p&gt;Django describes itself as "the web framework for perfectionists with deadlines," and that is an accurate summary. It is opinionated, batteries-included, and designed to get production-quality applications running quickly without requiring you to assemble your own stack.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Django includes out of the box:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ORM (object-relational mapper) for database access&lt;/li&gt;
&lt;li&gt;Admin interface generated from your data models&lt;/li&gt;
&lt;li&gt;Authentication and authorisation system&lt;/li&gt;
&lt;li&gt;Form handling and validation&lt;/li&gt;
&lt;li&gt;Template engine&lt;/li&gt;
&lt;li&gt;Security defaults (CSRF protection, clickjacking protection, SQL injection prevention)&lt;/li&gt;
&lt;li&gt;Comprehensive test runner&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Django excels at:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Content-managed websites and blogs&lt;/li&gt;
&lt;li&gt;Admin-heavy applications where the built-in admin panel saves significant development time&lt;/li&gt;
&lt;li&gt;Applications with complex data models and relationships&lt;/li&gt;
&lt;li&gt;Projects where a small team needs to cover a lot of ground quickly&lt;/li&gt;
&lt;li&gt;Situations where security defaults matter (regulated industries, healthcare, fintech)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Django's limitations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Heavier than Flask or FastAPI for simple API-only services&lt;/li&gt;
&lt;li&gt;Async support improved significantly in recent versions but is not as native as FastAPI&lt;/li&gt;
&lt;li&gt;The "Django way" is opinionated; stepping outside it requires more effort&lt;/li&gt;
&lt;li&gt;Can feel over-engineered for microservices or simple REST endpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Django in 2026:&lt;/strong&gt; Django 5.x has improved async support substantially, and the Django REST Framework remains a solid choice for APIs with complex authentication, permissions, and serialisation requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flask: The Microframework
&lt;/h2&gt;

&lt;p&gt;Flask takes the opposite philosophy to Django. It provides a minimal core: routing, request handling, and response generation. Everything else is a decision you make by choosing extensions or writing it yourself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Flask includes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;URL routing&lt;/li&gt;
&lt;li&gt;Request and response objects&lt;/li&gt;
&lt;li&gt;Template engine (Jinja2)&lt;/li&gt;
&lt;li&gt;Development server and debugger&lt;/li&gt;
&lt;li&gt;Extension ecosystem for everything else&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Flask excels at:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Small to medium APIs where you want full control over the stack&lt;/li&gt;
&lt;li&gt;Microservices where a lightweight footprint matters&lt;/li&gt;
&lt;li&gt;Prototypes and proof-of-concept builds&lt;/li&gt;
&lt;li&gt;Situations where you need flexibility over convention&lt;/li&gt;
&lt;li&gt;Projects where the team wants to assemble their own components&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Flask's limitations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No async support by default (Flask 2.x has limited async; Quart is the async variant)&lt;/li&gt;
&lt;li&gt;No built-in ORM, authentication, or admin interface; you assemble these from extensions&lt;/li&gt;
&lt;li&gt;Extension quality varies significantly; some are unmaintained&lt;/li&gt;
&lt;li&gt;For large teams or complex projects, the lack of structure can cause inconsistency&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Flask in 2026:&lt;/strong&gt; Flask remains widely used for internal tools, microservices, and ML model serving. It is not the cutting edge choice for new API projects, but its simplicity means it will stay relevant for teams that know it well.&lt;/p&gt;

&lt;h2&gt;
  
  
  FastAPI: The Modern API Framework
&lt;/h2&gt;

&lt;p&gt;FastAPI is the framework that has changed the Python API landscape most significantly in recent years. It is built on Starlette (for async request handling) and Pydantic (for data validation and serialisation), and it generates OpenAPI documentation automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What FastAPI includes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full async support via Python's asyncio&lt;/li&gt;
&lt;li&gt;Automatic request validation using Python type hints&lt;/li&gt;
&lt;li&gt;Automatic OpenAPI (Swagger) documentation generation&lt;/li&gt;
&lt;li&gt;Dependency injection system&lt;/li&gt;
&lt;li&gt;OAuth2 and JWT authentication helpers&lt;/li&gt;
&lt;li&gt;WebSocket support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;FastAPI excels at:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High-performance REST APIs and microservices&lt;/li&gt;
&lt;li&gt;AI and ML model serving (the async model handles concurrent inference requests efficiently)&lt;/li&gt;
&lt;li&gt;Microservices that need to handle significant concurrent load&lt;/li&gt;
&lt;li&gt;APIs where automatic documentation is a requirement&lt;/li&gt;
&lt;li&gt;Teams that want type safety and validation without writing boilerplate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;FastAPI's limitations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No built-in ORM (typically used with SQLAlchemy or Tortoise ORM)&lt;/li&gt;
&lt;li&gt;No built-in admin interface&lt;/li&gt;
&lt;li&gt;Younger ecosystem than Django or Flask; fewer battle-tested extensions&lt;/li&gt;
&lt;li&gt;Async code requires understanding of Python's async/await model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;FastAPI in 2026:&lt;/strong&gt; FastAPI is the fastest-growing Python web framework by adoption metrics. For new API projects, particularly those involving AI integration, it is increasingly the default choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Head-to-Head Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Criteria&lt;/th&gt;
&lt;th&gt;Django&lt;/th&gt;
&lt;th&gt;Flask&lt;/th&gt;
&lt;th&gt;FastAPI&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Performance (requests/sec)&lt;/td&gt;
&lt;td&gt;Good&lt;/td&gt;
&lt;td&gt;Good&lt;/td&gt;
&lt;td&gt;Excellent (async)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learning curve&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Batteries included&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Partial&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Async support&lt;/td&gt;
&lt;td&gt;Improved (v5+)&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;td&gt;Native&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ORM&lt;/td&gt;
&lt;td&gt;Built-in&lt;/td&gt;
&lt;td&gt;Extension&lt;/td&gt;
&lt;td&gt;Extension&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Admin interface&lt;/td&gt;
&lt;td&gt;Built-in&lt;/td&gt;
&lt;td&gt;Extension&lt;/td&gt;
&lt;td&gt;Extension&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Auto API docs&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes (OpenAPI)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Type safety&lt;/td&gt;
&lt;td&gt;Optional&lt;/td&gt;
&lt;td&gt;Optional&lt;/td&gt;
&lt;td&gt;Built-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Full web apps&lt;/td&gt;
&lt;td&gt;Microservices&lt;/td&gt;
&lt;td&gt;Modern APIs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Community size&lt;/td&gt;
&lt;td&gt;Very large&lt;/td&gt;
&lt;td&gt;Large&lt;/td&gt;
&lt;td&gt;Growing fast&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Production maturity&lt;/td&gt;
&lt;td&gt;Very high&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Which Python Web Framework Should You Choose in 2026?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Choose Django when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You are building a full web application with user authentication, admin functionality, and complex data relationships&lt;/li&gt;
&lt;li&gt;Your team is small and needs to move fast with sensible defaults&lt;/li&gt;
&lt;li&gt;You are working in a regulated industry where security defaults matter&lt;/li&gt;
&lt;li&gt;You are building a content management system, e-commerce platform, or similar full-stack product&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Choose Flask when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You are building a small API or microservice where you want minimal overhead&lt;/li&gt;
&lt;li&gt;The team has existing Flask expertise and the project scope does not justify switching&lt;/li&gt;
&lt;li&gt;You are serving a machine learning model and want the lightest possible wrapper&lt;/li&gt;
&lt;li&gt;You are prototyping quickly and want minimal setup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Choose FastAPI when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You are building a REST API that needs to handle significant concurrent load&lt;/li&gt;
&lt;li&gt;You are integrating with AI APIs and want async request handling&lt;/li&gt;
&lt;li&gt;Your team uses Python type hints and wants validation built into the framework&lt;/li&gt;
&lt;li&gt;You need automatic OpenAPI documentation for internal or external consumers&lt;/li&gt;
&lt;li&gt;You are starting a new project without legacy constraints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For most new Python API projects in 2026, FastAPI is the strongest default choice. Django remains the right answer for full web applications. Flask is best reserved for teams with existing expertise or genuinely minimal requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running FastAPI in Production: A Quick Setup
&lt;/h2&gt;

&lt;p&gt;A minimal FastAPI application looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pydantic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;

&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;root&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;API is running&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nd"&gt;@app.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/items/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;create_item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it with Uvicorn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uvicorn main:app &lt;span class="nt"&gt;--reload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FastAPI generates Swagger UI automatically at &lt;code&gt;/docs&lt;/code&gt; and ReDoc at &lt;code&gt;/redoc&lt;/code&gt;. This is something Django and Flask require additional packages to achieve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Django is the best choice for full web applications with complex data models and admin requirements.&lt;/li&gt;
&lt;li&gt;Flask suits microservices and teams that want full control over their stack with minimal framework opinions.&lt;/li&gt;
&lt;li&gt;FastAPI is the strongest choice for new API projects in 2026, particularly those involving AI integration or high concurrency requirements.&lt;/li&gt;
&lt;li&gt;All three are production-ready; the decision is about fit with your project scope, team expertise, and performance requirements.&lt;/li&gt;
&lt;li&gt;If you are starting a new Python backend project today with no legacy constraints, default to FastAPI and reach for Django only when you need its full-stack features.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/backend-development-in-2026-technologies-costs-and-uk-hiring-guide/" rel="noopener noreferrer"&gt;Backend Development in 2026 - Technologies, Costs, UK Hiring&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/rest-api-vs-graphql-which-to-choose-for-your-project-in-2026/" rel="noopener noreferrer"&gt;REST API vs GraphQL in 2026 - How to Choose the Right One&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/how-to-build-a-web-app-in-2026-the-uk-developers-guide/" rel="noopener noreferrer"&gt;How to Build a Web App in 2026 - The UK Developer's Guide&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/symfony-vs-laravel-2026/" rel="noopener noreferrer"&gt;Symfony vs Laravel in 2026: Which PHP Framework to Choose&lt;/a&gt;., &lt;a href="https://mecanik.dev/en/posts/node.js-vs-python-which-backend-language-to-choose-in-2026/" rel="noopener noreferrer"&gt;Node.js vs Python - Which Backend Language to Choose in 2026&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions (FAQ)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is FastAPI faster than Django?&lt;/strong&gt;&lt;br&gt;
Yes, for API workloads. FastAPI's async architecture allows it to handle significantly more concurrent requests than synchronous Django. However, Django 5.x has improved async support, and the performance difference narrows for database-bound workloads where the bottleneck is the database, not the framework.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Django still relevant in 2026?&lt;/strong&gt;&lt;br&gt;
Very much so. Django's ecosystem, security defaults, and admin interface make it the right choice for full web applications. Its adoption in regulated industries, content-managed websites, and full-stack applications remains strong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can you use FastAPI with a database?&lt;/strong&gt;&lt;br&gt;
Yes. FastAPI works with SQLAlchemy (the most common choice), Tortoise ORM, and other Python database libraries. The setup is slightly more manual than Django's built-in ORM, but the flexibility is greater.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which Python framework is easiest to learn?&lt;/strong&gt;&lt;br&gt;
Flask has the lowest initial barrier because it provides so little: you see exactly what you write. Django's "magic" can be confusing at first but becomes productive faster once understood. FastAPI requires understanding Python type hints and async/await, which adds a learning step but pays off in productivity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use Django and FastAPI together?&lt;/strong&gt;&lt;br&gt;
Yes. A common pattern is using Django for the web frontend and admin, while FastAPI handles a high-performance API layer. They can share the same database. This is a reasonable architecture when you need both the Django admin and high-concurrency API performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Python framework do companies use for AI APIs?&lt;/strong&gt;&lt;br&gt;
FastAPI has become the most common choice for AI API services in 2026, particularly for companies exposing ML models or integrating with providers like Anthropic or OpenAI. Its async support handles the latency of AI model calls better than synchronous frameworks.&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>flask</category>
      <category>fastapi</category>
    </item>
    <item>
      <title>Bespoke CRM &amp; ERP Development: Build vs Buy Guide 2026</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Mon, 21 Sep 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/bespoke-crm-erp-development-build-vs-buy-guide-2026-341m</link>
      <guid>https://dev.to/mecanik-dev/bespoke-crm-erp-development-build-vs-buy-guide-2026-341m</guid>
      <description>&lt;p&gt;The build vs buy software decision is one of the most consequential choices facing enterprise executives who are planning a new CRM or ERP platform in 2026. Off-the-shelf Software-as-a-Service (SaaS) systems initially seem attractive because they offer immediate setup with lower entry costs. As operational models scale, however, per-seat licensing fees, transaction commissions, and rigid customisation options can heavily restrict growth. Building custom software, by contrast, guarantees full code ownership, database flexibility, and unlimited API integrations. This guide outlines the key budgeting, operational, and architectural considerations you need to resolve the choice.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Decision Guideline:&lt;/strong&gt; Choose the SaaS option if the software handles non-differentiating tasks (like payroll processing or basic email marketing). Conversely, build bespoke software if the system handles your core business workflows or houses proprietary IP that sets you apart from competitors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaways:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Evaluating this decision means weighing licensing overhead, customisation limits, and data ownership.&lt;/li&gt;
&lt;li&gt;SaaS is faster to deploy but introduces monthly per-seat licensing fees that scale aggressively with user growth.&lt;/li&gt;
&lt;li&gt;Bespoke CRM/ERP development requires higher initial investment but yields a lower total cost of ownership over a three-year period.&lt;/li&gt;
&lt;li&gt;Custom code guarantees full data sovereignty and allows direct integrations without paying marketplace app fees.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The SaaS Trap: Hidden Costs of Off-the-Shelf Software
&lt;/h2&gt;

&lt;p&gt;Market research from &lt;a href="https://www.gartner.com/" rel="noopener noreferrer"&gt;Gartner&lt;/a&gt; highlights that enterprise cloud spending frequently exceeds budgets due to unexpected software licence tiers. While buying a ready-made CRM (like Salesforce or HubSpot) or ERP (like SAP) seems simple, it introduces several hidden cost variables:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Per-User Licensing Scales Aggressively
&lt;/h3&gt;

&lt;p&gt;Most SaaS providers charge on a per-user, per-month basis. Consequently, adding customer service agents, warehouse coordinators, or sales reps to your database drives up operational bills month-after-month.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Marketplace App and Add-on Dependencies
&lt;/h3&gt;

&lt;p&gt;Out-of-the-box platforms rarely fit your business workflows exactly. To add custom fields, payment processors, or shipping integrations, you must purchase third-party add-ons from SaaS marketplaces. These plugins often charge recurring monthly fees, further inflating your bills.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Data Lock-in and Migration Penalties
&lt;/h3&gt;

&lt;p&gt;SaaS companies host your data on their proprietary servers. If you decide to migrate to another provider, extracting your database relationships, logs, and attachments is a complex process. Often, you will face high data-export fees or corrupt databases.&lt;/p&gt;




&lt;h2&gt;
  
  
  When to Build Bespoke CRM or ERP Software
&lt;/h2&gt;

&lt;p&gt;Choosing to build custom software represents a significant initial capital investment. Therefore, this decision should be justified by strategic business metrics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bespoke Workflows:&lt;/strong&gt; Your business model has unique inventory tracking, supplier routes, or customer pipelines that SaaS templates cannot map without complex configurations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Sovereignty:&lt;/strong&gt; You handle sensitive medical, financial, or legal customer records and require full control over database encryption and local server locations to meet GDPR requirements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Licensing Costs:&lt;/strong&gt; You want to scale your platform to hundreds of field agents or external clients without paying per-seat licence fees.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Financial Comparison: SaaS vs. Bespoke Build (3-Year Plan)
&lt;/h2&gt;

&lt;p&gt;To assist your budgeting planning, the following table details the cost projection for 50 platform users over 3 years:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cost Variable&lt;/th&gt;
&lt;th&gt;SaaS (Salesforce/HubSpot Tier)&lt;/th&gt;
&lt;th&gt;Custom ERP/CRM Development&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Initial Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;£5,000 (Setup &amp;amp; Configuration)&lt;/td&gt;
&lt;td&gt;£65,000 (Bespoke Engineering)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Year 1 Licensing / Hosting&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;£45,000 (£75 per user/month)&lt;/td&gt;
&lt;td&gt;£1,200 (Cloud Edge Hosting)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Year 2 Licensing / Hosting&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;£48,000 (Estimated 5% price hike)&lt;/td&gt;
&lt;td&gt;£1,200 (Cloud Edge Hosting)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Year 3 Licensing / Hosting&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;£50,400 (Estimated 5% price hike)&lt;/td&gt;
&lt;td&gt;£1,200 (Cloud Edge Hosting)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Annual Support / Maintenance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Included in licensing&lt;/td&gt;
&lt;td&gt;£7,500 (Annual SLA patches)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;3-Year Total Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;£148,400&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;£91,100&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;As the figures show, the high custom software development cost of a bespoke build is amortised rapidly. By year two, the custom ERP or CRM becomes more cost-effective than SaaS, saving the business thousands in licensing fees.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Five-Year Total Cost of Ownership
&lt;/h2&gt;

&lt;p&gt;The three-year projection already tips towards a bespoke build, but most enterprise platforms run for five years or longer, and the gap widens with time. Two forces drive that divergence: per-seat licence fees compound as your team grows and vendors raise prices at renewal, whereas a custom system's running costs stay broadly flat once it is live.&lt;/p&gt;

&lt;p&gt;For context, mainstream CRM seats list anywhere from roughly £25 per user per month for entry tiers to £300 or more for top enterprise editions of a platform like Salesforce, while HubSpot's professional and enterprise sales tiers commonly sit in the £90–£135 range (list prices, billed annually, exclusive of VAT and add-ons). The £75 per-seat figure used in the table above is deliberately mid-market; premium editions widen the gap further still.&lt;/p&gt;

&lt;p&gt;Extending the same 50-user scenario to five years, applying the identical 5% annual price rises, shows how the two curves separate (figures illustrative):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;3-Year Total&lt;/th&gt;
&lt;th&gt;Years 4–5&lt;/th&gt;
&lt;th&gt;5-Year Total&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SaaS (per-seat licensing)&lt;/td&gt;
&lt;td&gt;£148,400&lt;/td&gt;
&lt;td&gt;£108,486&lt;/td&gt;
&lt;td&gt;~£257,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bespoke build (upfront + hosting + maintenance)&lt;/td&gt;
&lt;td&gt;£91,100&lt;/td&gt;
&lt;td&gt;£17,400&lt;/td&gt;
&lt;td&gt;~£108,500&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The headline gap is real, but honest budgeting means counting the line items each side tends to leave out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Understated on the SaaS side:&lt;/strong&gt; integration middleware to connect the platform to your other tools, premium support tiers, marketplace add-ons billed per user, sandbox and testing environments, and the admin staff time to configure and maintain the instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Understated on the bespoke side:&lt;/strong&gt; ongoing maintenance and security patching (budget roughly 10–20% of the original build cost per year as a rule of thumb), hosting and monitoring, and a development partner or in-house engineer to evolve the system.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A fair comparison puts both fully loaded totals side by side, rather than the sticker price of one against the fully costed version of the other.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do Not Forget Switching Costs
&lt;/h3&gt;

&lt;p&gt;Whichever way you lean, price in the cost of changing your mind later. Leaving a SaaS platform means extracting years of records, relationships, attachments, and audit logs from a proprietary schema, often with export fees, reformatting work, and a disruptive cut-over. That switching cost is exactly what hands an incumbent vendor pricing power at renewal. A bespoke system carries no equivalent lock-in, because you own both the database and the code and therefore control the migration path — though the same ownership means you alone are responsible for keeping the platform patched and secure.&lt;/p&gt;




&lt;h2&gt;
  
  
  Build vs Buy at a Glance: The Full Decision Matrix
&lt;/h2&gt;

&lt;p&gt;Cost is only one axis. Before committing capital, weigh the two models across every dimension that shapes the platform over its working life. The matrix below summarises how off-the-shelf SaaS and a bespoke build typically compare.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Off-the-Shelf SaaS&lt;/th&gt;
&lt;th&gt;Bespoke Build&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Time to first value&lt;/td&gt;
&lt;td&gt;Days to a few weeks&lt;/td&gt;
&lt;td&gt;Three to six months for a first release&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Up-front cost&lt;/td&gt;
&lt;td&gt;Low (setup and configuration)&lt;/td&gt;
&lt;td&gt;High (discovery, design, engineering)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ongoing cost model&lt;/td&gt;
&lt;td&gt;Per-seat, grows with headcount&lt;/td&gt;
&lt;td&gt;Fixed hosting plus maintenance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Customisation ceiling&lt;/td&gt;
&lt;td&gt;Limited to the vendor's roadmap&lt;/td&gt;
&lt;td&gt;Unlimited — you own the code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data ownership&lt;/td&gt;
&lt;td&gt;Vendor-hosted, export on their terms&lt;/td&gt;
&lt;td&gt;Full sovereignty on your infrastructure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scalability economics&lt;/td&gt;
&lt;td&gt;Cost rises with every user added&lt;/td&gt;
&lt;td&gt;Marginal cost per user near zero&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Compliance control&lt;/td&gt;
&lt;td&gt;Bound by the vendor's certifications&lt;/td&gt;
&lt;td&gt;You set encryption, residency, and audit trails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vendor concentration risk&lt;/td&gt;
&lt;td&gt;High — pricing and roadmap set externally&lt;/td&gt;
&lt;td&gt;Low — no external licence dependency&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exit difficulty&lt;/td&gt;
&lt;td&gt;High — proprietary schema and formats&lt;/td&gt;
&lt;td&gt;You control the migration path&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Read quickly, the pattern is clear: SaaS wins on speed and up-front cost, while a bespoke build wins on long-run economics, control, and independence. The right answer turns on which of those your business values most.&lt;/p&gt;




&lt;h2&gt;
  
  
  Choose SaaS When… Choose a Bespoke Build When…
&lt;/h2&gt;

&lt;p&gt;The decision rarely splits neatly down the middle, so anchor it to concrete scenarios rather than instinct.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lean towards SaaS when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The process is a commodity — expense claims, help-desk ticketing, generic email marketing — where using the same tool as a competitor costs you nothing.&lt;/li&gt;
&lt;li&gt;Your seat count on the system is small and stable (roughly under 20–30 users), so per-seat fees never compound into a punishing annual bill.&lt;/li&gt;
&lt;li&gt;You need the system live this quarter and cannot absorb a build cycle.&lt;/li&gt;
&lt;li&gt;You have no appetite to own and maintain software over the long term.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lean towards a bespoke build when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The workflow is your competitive moat — a proprietary pricing engine, a unique fulfilment route, or a client portal that sets your service apart.&lt;/li&gt;
&lt;li&gt;You expect to add many users, field agents, franchisees, or external clients, where each SaaS seat multiplies the bill but a custom system absorbs them for the cost of hosting.&lt;/li&gt;
&lt;li&gt;Regulatory or contractual duties demand full control over where data lives and how it is encrypted.&lt;/li&gt;
&lt;li&gt;You have hit the ceiling of a SaaS tool's customisation and are stacking marketplace add-ons to fill the gaps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many organisations settle on a hybrid: buy for the commodity layer, build for the differentiating core. That is often the most defensible position, provided the two layers integrate cleanly through well-documented APIs.&lt;/p&gt;




&lt;h2&gt;
  
  
  Steps to Evaluate the Build vs. Buy Decision
&lt;/h2&gt;

&lt;p&gt;Before making a procurement decision, run through this structured evaluation framework:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Map Non-Negotiable Workflows:&lt;/strong&gt; Write down the core business processes that give you a competitive advantage. If SaaS cannot handle them natively, choose to build.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calculate the 3-Year Seat Cost:&lt;/strong&gt; Multiply your expected user count by the monthly SaaS licence fee, accounting for growth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analyse Integration Bottlenecks:&lt;/strong&gt; Confirm if your current logistics, database, or accounting APIs connect to the SaaS platform without custom middleware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vet your Partners:&lt;/strong&gt; Choose a development consultancy that will guide you through the roadmap and guarantee source code ownership.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Partner with a Vetted UK Software Consultancy
&lt;/h2&gt;

&lt;p&gt;Getting this decision right protects your long-term margins over the life of the platform, but a rigorous build vs buy software assessment is only as valuable as the team that acts on it. Mecanik provides professional &lt;a href="https://mecanik.dev/en/services/software-development/" rel="noopener noreferrer"&gt;custom software development services&lt;/a&gt; and dedicated engineers through the &lt;a href="https://mecanik.dev/en/hire-web-developer/" rel="noopener noreferrer"&gt;hire a web developer&lt;/a&gt; page. We specialise in C/C++ cross-platform desktop applications, Symfony backend systems, and edge-native integrations. Contact us today to schedule your technical discovery session.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/how-to-choose-and-hire-software-development-agency/" rel="noopener noreferrer"&gt;How to Choose and Hire a Software Development Agency&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/custom-software-development-cost-budgeting-guide/" rel="noopener noreferrer"&gt;Custom Software Development Cost: 2026 Budgeting Guide&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/legacy-software-modernisation-rewrite-vs-refactor/" rel="noopener noreferrer"&gt;Legacy Software Modernisation: Rewrite vs Refactor Guide&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/outsourcing-software-development-uk-vs-offshore/" rel="noopener noreferrer"&gt;Outsourcing Software Development: UK vs Offshore Guide&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is the build vs buy software decision?&lt;/strong&gt;&lt;br&gt;
The build vs buy software decision is the process of evaluating whether to purchase a ready-made SaaS licence or hire developers to build a bespoke application. This choice hinges on workflow complexity, data security requirements, user counts, and long-term financial calculations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is custom CRM development cheaper than SaaS for large teams?&lt;/strong&gt;&lt;br&gt;
Custom CRM development is more cost-effective for large teams because it eliminates monthly per-seat licensing fees. While SaaS costs scale with user growth, a custom CRM requires only a single upfront development cost and minor monthly hosting fees.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the main risks of buying off-the-shelf software?&lt;/strong&gt;&lt;br&gt;
The main risks include vendor lock-in, recurring price increases, limited API integration access, and dependency on third-party marketplace apps. Additionally, you do not own the database structure, which makes migrating your data to other systems difficult.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I measure the ROI of custom software?&lt;/strong&gt;&lt;br&gt;
To measure ROI, calculate the total cost of ownership (TCO) of both options over 3 to 5 years. Subtract the custom development and hosting costs from the SaaS licensing fees, and factor in productivity gains from automated, custom workflows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I run a hybrid build and buy strategy?&lt;/strong&gt;&lt;br&gt;
Yes, a hybrid strategy is common. Many businesses buy SaaS platforms for non-core tasks (like office email or accounting) and build custom software to handle their primary product delivery, client dashboards, or proprietary algorithms.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>wordpress</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Does True AI Exist? Unraveling the Myths and Reality</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Sun, 20 Sep 2026 18:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/does-true-ai-exist-unraveling-the-myths-and-reality-46gh</link>
      <guid>https://dev.to/mecanik-dev/does-true-ai-exist-unraveling-the-myths-and-reality-46gh</guid>
      <description>&lt;p&gt;Artificial Intelligence (AI) has been an intriguing subject, often wrapped in an enigma, driven by speculation, and enhanced with Hollywood glitz.&lt;/p&gt;

&lt;p&gt;While movies paint a picture of AI as sentient entities, filled with emotions and consciousness, one must wonder if today's AI mirrors such representation. It's time to uncover the reality of AI in the contemporary era.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Basics of AI
&lt;/h2&gt;

&lt;p&gt;To decode AI, a foundational understanding is pivotal. Artificial Intelligence fundamentally revolves around creating computer systems capable of executing tasks that traditionally mandate human intelligence. From speech recognition to decision-making, these tasks have one essence - they perform rather than genuinely understand or feel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Consider your smartphone's voice assistant, like Siri or Google Assistant. When you ask it about the weather, it swiftly fetches the information and responds. This rapid retrieval and response make it seem intelligent.&lt;/p&gt;

&lt;p&gt;However, it doesn't "understand" weather in the way humans do; it doesn't feel the warmth of the sun or the chill of the wind. Instead, it recognizes your voice command, processes the data, and delivers the requested information based on its programming and the data it has access to.&lt;/p&gt;

&lt;p&gt;This is AI in action, a combination of voice recognition and data processing, delivering a task that mimics human-like interaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not Sentient, But Highly Efficient
&lt;/h2&gt;

&lt;p&gt;Hollywood might suggest AIs with deep emotions and intricate feelings, but today’s AI models, like &lt;a href="https://openai.com/gpt-4" rel="noopener noreferrer"&gt;GPT-4&lt;/a&gt; by OpenAI, are strictly computational. Functioning as intricate mathematical models, they process vast datasets at incredible speeds. Their “decisions” are more about instant computations than genuine emotional manifestations.&lt;/p&gt;

&lt;p&gt;Regrettably, the dream of an emotionally sentient AI eludes us. To quote Wikipedia:&lt;/p&gt;

&lt;blockquote&gt;
Artificial intelligence (AI) is the intelligence of machines or software, as opposed to the intelligence of human beings or animals. AI applications include advanced web search engines (e.g., Google Search), recommendation systems (used by YouTube, Amazon, and Netflix), understanding human speech (such as Siri and Alexa), self-driving cars (e.g., Waymo), generative or creative tools (ChatGPT and AI art), and competing at the highest level in strategic games (such as chess and Go).
&lt;/blockquote&gt;

&lt;p&gt;Such definitions burst the bubble of having a conversational AI companion that can resonate with our emotions and authentically mirror human behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Machine Learning: The Underpinning of Modern AI
&lt;/h2&gt;

&lt;p&gt;Modern AI owes much to Machine Learning (ML). ML, by analyzing extensive data, enables machines to acquire the ability to execute certain tasks without direct programming.&lt;/p&gt;

&lt;p&gt;However, it's essential to note that this is more about recognizing patterns statistically rather than truly understanding them, which, admittedly, may disappoint fans of cinematic AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Imagine you're browsing through a music streaming platform like Spotify. Over time, you might notice that the platform suggests songs or playlists that align closely with your musical tastes. This isn’t magic; it's Machine Learning at work.&lt;/p&gt;

&lt;p&gt;Every time you listen to a song, skip one, or add one to your playlist, Spotify gathers this data. The ML algorithms then analyze your preferences and identify patterns. Based on these patterns, the platform can predict and recommend other songs or genres you might enjoy.&lt;/p&gt;

&lt;p&gt;So, the more you use the platform, the better it gets at understanding your musical preferences, all thanks to the power of Machine Learning (ML).&lt;/p&gt;

&lt;h2&gt;
  
  
  From Narrow AI to AGI: Where Are We?
&lt;/h2&gt;

&lt;p&gt;There are two broad categories of AI: &lt;strong&gt;Narrow AI&lt;/strong&gt; and &lt;strong&gt;General AI&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Narrow AI&lt;/strong&gt;: What we predominantly have today. These AIs excel in a specific task, whether that's translating languages or playing a game. They don't have general understanding or consciousness.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;General AI (AGI)&lt;/strong&gt;: The hypothetical future AI that can outperform humans at nearly every cognitive task. It's more akin to the AI from movies, but we're not there yet, and it's debatable if we ever will be.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;To illustrate the difference&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Narrow AI&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think about the chess-playing computer program, Deep Blue, &lt;a href="https://en.wikipedia.org/wiki/Deep_Blue_versus_Garry_Kasparov" rel="noopener noreferrer"&gt;that beat world chess champion Garry Kasparov&lt;/a&gt; in the late '90s. Deep Blue was exceptional at playing chess, even beating one of the best human players, but that's all it could do.&lt;/p&gt;

&lt;p&gt;Ask it to make you a cup of coffee or write a poem, and it would be utterly lost.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;General AI (AGI)&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Picture the fictional AI, Data, from "Star Trek: The Next Generation." Data possesses vast knowledge across countless subjects, from literature and science to music and human behavior.&lt;/p&gt;

&lt;p&gt;He can paint, play instruments, engage in philosophical debates, and adapt to new situations. This flexibility and adaptability across various domains represent the idea of AGI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Confusion?
&lt;/h2&gt;

&lt;p&gt;Hollywood and media hype have inadvertently crafted a magnified AI image. When AIs take on historically human-exclusive tasks, it becomes tempting to anthropomorphize them, leading to misinterpretations.&lt;/p&gt;

&lt;p&gt;Childhood memories filled with cartoons and movies painted a future teeming with AI. But reality tells a different story. Our technological priorities seem misplaced, with genuine innovation often sidelined for monetary gains.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Future of AI: What to Expect
&lt;/h2&gt;

&lt;p&gt;Even with monumental strides in AI, its core remains computational. The aspiration (or fear) of sentient machines is still anchored in fiction. Yet, AI's promise to revolutionize industries and elevate living standards stands undisputed.&lt;/p&gt;

&lt;p&gt;The real evolution towards sentient AI, in my view, might only see the light with the advent of &lt;a href="https://en.wikipedia.org/wiki/Quantum_computing" rel="noopener noreferrer"&gt;Quantum Computers&lt;/a&gt;. A noteworthy development that could supercharge AI's progression is the advent and refinement of Quantum Computers.&lt;/p&gt;

&lt;p&gt;Traditional computers utilize bits as the smallest unit of data, represented by either a 0 or a 1. Quantum Computers, however, leverage quantum bits or qubits, which can exist in a state of 0, 1, or both simultaneously due to superposition. This characteristic exponentially enhances their computational power.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Imagine trying to solve a complex maze. A traditional computer would test each possible route one at a time to find the solution. A Quantum Computer, in contrast, can explore multiple routes simultaneously, dramatically reducing the time needed to find the solution. When applied to AI, this could mean faster data processing, more sophisticated algorithms, and breakthroughs in areas that are currently computationally prohibitive.&lt;/p&gt;

&lt;p&gt;It's speculated that with Quantum Computing, AI could inch closer to achieving feats previously considered unattainable. Some experts even suggest that true AI might only be realized once we've harnessed the full potential of Quantum Computing. While we're still in the early days of this technology, its implications for AI are profound and eagerly anticipated.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Today's AI, a marvel in its own right, is altering the very fabric of our society. Although it's far from the sentient entities depicted in films, its computational prowess cannot be undermined. As we navigate this era of technological marvel, understanding and judiciously utilizing AI becomes paramount.&lt;/p&gt;

&lt;p&gt;In a world riddled with misinformation, AI often falls victim to misconceptions. It's imperative for the believer to discern the actual capabilities of AI, avoiding misinterpretations. This article aims to shed light on the reality of AI, its implications, and its future trajectory.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/chatgpt-unleashing-ai-language-models-for-communication/" rel="noopener noreferrer"&gt;ChatGPT: Unleashing AI Language Models for Communication&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/retrieval-augmented-generation-rag-explained/" rel="noopener noreferrer"&gt;Retrieval-Augmented Generation (RAG) Explained 2026&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/openai-chatgpt-5-vs-grok-4-which-one-creates-better-python-code/" rel="noopener noreferrer"&gt;OpenAI ChatGPT 5 vs Grok 4 - Which one creates better Python code?&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/claude-api-vs-openai-api-for-developers/" rel="noopener noreferrer"&gt;Claude API vs OpenAI API: A Developer's Comparison 2026&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>AI Integration Cost: 2026 Enterprise Budgeting Guide</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Sun, 20 Sep 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/ai-integration-cost-2026-enterprise-budgeting-guide-5f83</link>
      <guid>https://dev.to/mecanik-dev/ai-integration-cost-2026-enterprise-budgeting-guide-5f83</guid>
      <description>&lt;p&gt;Determining the true AI integration cost is a major financial step for UK businesses looking to deploy Large Language Models (LLMs) in 2026. Integrating AI into software applications automates customer service pipelines, increases productivity, and unlocks conversational data insights. However, budgeting for these setups involves more than looking at developer hourly rates. Specifically, businesses must calculate recurring token fees, vector database hosting, and prompt validation middleware expenses. This guide details the pricing structures, API mechanics, and deployment costs associated with custom AI integration.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;API Billing Warning:&lt;/strong&gt; Always configure hard spending limits in your provider dashboards (like OpenAI or Anthropic). Bypassing this step exposes your business to unexpected bills if a coding loop or user request triggers infinite recursion calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaways:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your total cost depends on token usage volumes, database requirements, and middleware security.&lt;/li&gt;
&lt;li&gt;Small-scale chatbot integrations range from £5,000 to £12,000, while multi-agent setups start at £30,000.&lt;/li&gt;
&lt;li&gt;Prompt caching discount structures drastically reduce recurring API token costs for high-volume apps.&lt;/li&gt;
&lt;li&gt;Storing company knowledge bases in vector databases requires indexing maintenance, adding hosting overhead.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What Determines the AI Integration Cost?
&lt;/h2&gt;

&lt;p&gt;Evaluating an AI project requires analysing three distinct cost layers: development time, recurring API token fees, and cloud hosting infrastructure. According to the &lt;a href="https://openai.com/" rel="noopener noreferrer"&gt;OpenAI API pricing guide&lt;/a&gt;, API fees are calculated per million tokens, separating input and output variables.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Development and Engineering Time
&lt;/h3&gt;

&lt;p&gt;Writing code to connect to an LLM is relatively fast. However, building a production-ready application requires prompt engineering, output schema validation, and guardrails to prevent hallucinated answers. Developers must construct robust prompt guidelines and deploy parsing scripts to secure data structures, and this engineering time constitutes the bulk of the initial setup budget.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Recurring API Token Billing
&lt;/h3&gt;

&lt;p&gt;Every word sent to or received from an LLM represents tokens. Input tokens (the prompt and cached files) are cheaper than output tokens (the response generated by the model), so managing context lengths is essential to prevent billing creep. For instance, platforms like Anthropic offer dynamic discounts for cached prompts, which can lower input token bills by up to ninety percent.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Vector Database and Edge Hosting Infrastructure
&lt;/h3&gt;

&lt;p&gt;To give an AI agent access to private company knowledge, developers must convert documents into mathematical vectors. Storing these vectors requires specialised vector databases (such as Pinecone, Qdrant, or Cloudflare Vectorize). Index volume and database memory allocations directly dictate the hosting fees, so developers must optimise vector chunks to prevent hosting cost overruns.&lt;/p&gt;




&lt;h2&gt;
  
  
  Average AI Integration Cost Breakdown in 2026
&lt;/h2&gt;

&lt;p&gt;To assist your budgeting planning, the following table details the average cost metrics for custom AI integrations in the UK:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Integration Scale&lt;/th&gt;
&lt;th&gt;Initial Development Cost (GBP)&lt;/th&gt;
&lt;th&gt;Estimated Monthly API Cost (per 10k queries)&lt;/th&gt;
&lt;th&gt;Key Tech Stack&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Simple Chatbot / FAQ Bot&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;£5,000 - £12,000&lt;/td&gt;
&lt;td&gt;£20 - £50&lt;/td&gt;
&lt;td&gt;OpenAI GPT-4o-mini / Vercel Edge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Enterprise RAG Knowledge Base&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;£12,000 - £30,000&lt;/td&gt;
&lt;td&gt;£150 - £400&lt;/td&gt;
&lt;td&gt;Claude Opus 4.8 / Pinecone / Cloudflare&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Autonomous Multi-Agent Loop&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;£30,000 - £75,000+&lt;/td&gt;
&lt;td&gt;£500 - £1,500+&lt;/td&gt;
&lt;td&gt;LangChain / Cloudflare Workers / Vectorize&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  A Worked Example: Estimating a Monthly API Bill
&lt;/h2&gt;

&lt;p&gt;Headline ranges only tell you so much, so here is how the token maths actually works for a mid-sized retrieval-augmented (RAG) assistant. Assume it answers &lt;strong&gt;10,000 queries a month&lt;/strong&gt;, and each query sends:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Around 800 tokens of system prompt and guardrail instructions&lt;/li&gt;
&lt;li&gt;Around 1,500 tokens of retrieved context (the relevant document chunks)&lt;/li&gt;
&lt;li&gt;Around 200 tokens for the user's question&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is roughly &lt;strong&gt;2,500 input tokens&lt;/strong&gt; per query, plus perhaps &lt;strong&gt;600 output tokens&lt;/strong&gt; in the response. Across 10,000 queries, that comes to &lt;strong&gt;25 million input tokens&lt;/strong&gt; and &lt;strong&gt;6 million output tokens&lt;/strong&gt; a month.&lt;/p&gt;

&lt;p&gt;Applying illustrative frontier-model rates of about &lt;strong&gt;£2.40 per million input tokens&lt;/strong&gt; and &lt;strong&gt;£12 per million output tokens&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input: 25 × £2.40 = &lt;strong&gt;£60&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Output: 6 × £12 = &lt;strong&gt;£72&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Total ≈ £132 per month&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That lands just below the £150 to £400 band in the table above, because this worked example is a deliberately lean single-agent setup. Two things push it up fast: longer retrieved context (double the chunks and you roughly double the input bill) and higher query volumes. One thing pulls it down sharply. The 800-token system prompt is identical on every call, so &lt;strong&gt;prompt caching&lt;/strong&gt; that static portion can cut its cost by up to ninety percent, saving around £20 a month here and far more at scale. Routing simple queries to a smaller model can cut the bill by another order of magnitude again.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the Build Budget Actually Covers
&lt;/h2&gt;

&lt;p&gt;The initial development figure is not one line item; it is a sequence of engineering stages. A typical &lt;strong&gt;£12,000 to £30,000 enterprise RAG build&lt;/strong&gt; breaks down roughly like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Typical effort&lt;/th&gt;
&lt;th&gt;What it delivers&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Discovery &amp;amp; data audit&lt;/td&gt;
&lt;td&gt;3-5 days&lt;/td&gt;
&lt;td&gt;Scope, data sources, success metrics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAG pipeline&lt;/td&gt;
&lt;td&gt;5-10 days&lt;/td&gt;
&lt;td&gt;Ingestion, chunking, embeddings, vector store&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prompt engineering &amp;amp; guardrails&lt;/td&gt;
&lt;td&gt;4-8 days&lt;/td&gt;
&lt;td&gt;System prompts, output schemas, hallucination controls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Application &amp;amp; API integration&lt;/td&gt;
&lt;td&gt;5-10 days&lt;/td&gt;
&lt;td&gt;Backend, authentication, UI, streaming responses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Evaluation &amp;amp; testing&lt;/td&gt;
&lt;td&gt;3-6 days&lt;/td&gt;
&lt;td&gt;Automated answer-quality checks, regression tests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deployment &amp;amp; observability&lt;/td&gt;
&lt;td&gt;2-4 days&lt;/td&gt;
&lt;td&gt;Edge hosting, logging, cost monitoring&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The pipeline and evaluation stages are where budgets are won or lost. Skipping a proper evaluation harness looks cheaper on day one, but it is the difference between an assistant you can put in front of customers and one that quietly invents answers.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Ongoing Costs Teams Forget to Budget For
&lt;/h2&gt;

&lt;p&gt;Token fees are the visible cost. The ones that catch enterprises out sit underneath them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vector database hosting.&lt;/strong&gt; A managed store such as Pinecone or Cloudflare Vectorize bills on index size and query volume, separately from your LLM spend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-embedding and re-indexing.&lt;/strong&gt; Every time your source documents change, those chunks must be re-embedded, which is a recurring compute cost for fast-moving knowledge bases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observability and logging.&lt;/strong&gt; Tracing prompts, responses, and latency is essential for debugging and cost control, and log storage adds up at volume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation and regression testing.&lt;/strong&gt; Providers update their models, and a version that behaved yesterday can drift tomorrow, so you need an ongoing evaluation budget, not a one-off one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human review.&lt;/strong&gt; High-stakes answers in legal, financial, or medical contexts usually need a human-in-the-loop step, which is a staffing cost rather than a software one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance and data residency.&lt;/strong&gt; Keeping UK or EU data inside approved regions can rule out the cheapest hosting option and raise the baseline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A useful rule of thumb: budget &lt;strong&gt;15 to 20 percent of the initial build cost per year&lt;/strong&gt; for this maintenance and monitoring, on top of your API token fees.&lt;/p&gt;




&lt;h2&gt;
  
  
  Best Practices to Control Recurring AI Expenses
&lt;/h2&gt;

&lt;p&gt;Implementing strict engineering principles keeps recurring costs from escalating as user traffic grows. Adopt these four optimisation guidelines:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Leverage Prompt Caching:&lt;/strong&gt; Ensure your middleware caches static system prompts, system guidelines, and RAG contexts to minimise input token costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implement Vector Search (RAG):&lt;/strong&gt; Do not send entire files inside the LLM prompt. Instead, search the vector database first and send only the most relevant text blocks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route Tasks to Smaller Models:&lt;/strong&gt; Use fast, cheap models (like GPT-4o-mini or Gemini Flash) for classification tasks, reserving reasoning models for complex logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enforce Rate Limits:&lt;/strong&gt; Set strict per-user and per-key rate limits on your API gateway to prevent automated bot scripts from draining your token budget.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Partner with a Vetted UK AI Integration Consultancy
&lt;/h2&gt;

&lt;p&gt;Understanding the variables behind these figures protects your business from budget overruns. Mecanik provides professional &lt;a href="https://mecanik.dev/en/ai-integration-services/" rel="noopener noreferrer"&gt;AI integration services&lt;/a&gt; and developer integration through our &lt;a href="https://mecanik.dev/en/openai-api-integration/" rel="noopener noreferrer"&gt;OpenAI API integration service&lt;/a&gt; page. We specialise in building fast, secure LLM applications, RAG search engines, and real-time voice agents hosted on serverless edge worker networks. Contact us today to discuss your project requirements.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/claude-opus-4-8-vs-gpt-5-api/" rel="noopener noreferrer"&gt;Claude Opus 4.8 vs. OpenAI GPT-5: Which API is Best?&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/openai-api-integration-existing-application/" rel="noopener noreferrer"&gt;OpenAI API Integration: Adding GPT to an Existing App&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/claude-fable-5-hybrid-reasoning-api/" rel="noopener noreferrer"&gt;Claude Fable 5 Hybrid Reasoning: Thinking vs. Speed Modes&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/cloudflare-workers-ai-agent/" rel="noopener noreferrer"&gt;Building AI Agents with Cloudflare Workers and LangChain&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is the average ai integration cost?&lt;/strong&gt;&lt;br&gt;
The average cost of integrating AI ranges from £5,000 for a basic customer support FAQ chatbot to £30,000+ for enterprise retrieval-augmented generation (RAG) platforms. The final price depends on database sizes, UI design complexity, and security compliance requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do LLM API providers bill for usage?&lt;/strong&gt;&lt;br&gt;
LLM providers bill based on the number of tokens processed, separating input tokens (prompts) and output tokens (responses). Prices are calculated per million tokens, making prompt caching and query optimisation critical steps to reduce monthly operational bills.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What hosting infrastructure is required for AI agents?&lt;/strong&gt;&lt;br&gt;
AI agents require serverless edge hosting (like Cloudflare Workers) to handle WebSocket and HTTP requests, along with a vector database (such as Pinecone or Cloudflare Vectorize) to store and retrieve enterprise document segments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I run open-source AI models to avoid API fees?&lt;/strong&gt;&lt;br&gt;
Yes, you can run open-source models (such as Llama 3 or DeepSeek) to avoid API token costs. However, you must pay for GPU cloud instances to host these models, which can cost more than API tokens unless your query volumes are extremely high.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I prevent my AI chatbot from generating false information?&lt;/strong&gt;&lt;br&gt;
To prevent false information (hallucinations), implement a RAG structure that restricts the model's knowledge base to verified documents, write strict system prompts, and use schema validation middleware to block invalid responses.&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>api</category>
      <category>ai</category>
      <category>openai</category>
    </item>
    <item>
      <title>ChatGPT: Unleashing AI Language Models for Communication</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Sat, 19 Sep 2026 18:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/chatgpt-unleashing-ai-language-models-for-communication-1m74</link>
      <guid>https://dev.to/mecanik-dev/chatgpt-unleashing-ai-language-models-for-communication-1m74</guid>
      <description>&lt;p&gt;With the rapid advancement of artificial intelligence, the world has witnessed the emergence of cutting-edge technologies that have transformed various industries. One such innovation is ChatGPT, an AI-powered language model developed by OpenAI. Based on the GPT-4 architecture, ChatGPT has gained significant attention for its ability to generate human-like text, making it an indispensable tool for businesses, developers, and content creators.&lt;/p&gt;

&lt;p&gt;In this comprehensive guide, we'll explore the inner workings of ChatGPT, its wide-ranging applications, advantages and limitations, ethical concerns, and future prospects. By the end of this article, you'll have a solid understanding of how ChatGPT is revolutionizing the way we communicate and interact with technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is ChatGPT?
&lt;/h2&gt;

&lt;p&gt;ChatGPT is an advanced AI language model developed by OpenAI, built upon the GPT-4 architecture. It's designed to generate human-like text based on input prompts, offering contextually relevant and coherent responses. By understanding and processing natural language, ChatGPT can perform various tasks, such as answering questions, providing suggestions, and creating content.&lt;/p&gt;

&lt;p&gt;As a state-of-the-art AI language model, ChatGPT has demonstrated remarkable capabilities in producing contextually rich and nuanced text, making it an invaluable tool for a wide range of applications. Its versatility and adaptability have made it popular across industries, driving innovation and improving communication.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Does ChatGPT Work?
&lt;/h2&gt;

&lt;p&gt;ChatGPT is built on the GPT-4 architecture, which is a large-scale transformer model designed for natural language understanding and generation. The model is trained on massive amounts of text data from various sources, learning patterns, structures, and context in human language.&lt;/p&gt;

&lt;p&gt;GPT-4 is trained on vast amounts of data, allowing it to predict the next word in a sentence given its preceding context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Training Process
&lt;/h3&gt;

&lt;p&gt;The training process involves two main steps: pre-training and fine-tuning. During pre-training, ChatGPT learns to predict the next word in a sentence by analyzing billions of sentences. This helps the model acquire a deep understanding of language structure and context.&lt;/p&gt;

&lt;p&gt;In the fine-tuning phase, the model is refined using a smaller dataset with human-generated examples to enhance its performance and generate more accurate, contextually appropriate responses.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Token System
&lt;/h3&gt;

&lt;p&gt;ChatGPT operates using a token system, where each token represents a chunk of text, such as a word or a character. This system enables the model to break down input text into smaller units, making it easier for the AI to process and generate meaningful responses.&lt;/p&gt;

&lt;p&gt;When given a prompt, ChatGPT uses its knowledge of language patterns and context to generate a coherent and relevant response. It predicts the most likely sequence of words that should follow the input, taking into account the context and the specific task it's designed to perform.&lt;/p&gt;

&lt;h2&gt;
  
  
  Applications and Use Cases
&lt;/h2&gt;

&lt;p&gt;ChatGPT's ability to understand and generate human-like text makes it a valuable tool for various applications across multiple industries. Some of the most common use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Content Creation&lt;/strong&gt;: ChatGPT can generate high-quality content for blogs, articles, social media posts, and more, assisting writers in drafting and refining their work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customer Support&lt;/strong&gt;: ChatGPT-powered chatbots can handle customer inquiries, reducing response time and improving overall user experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Generation&lt;/strong&gt;: Developers can leverage ChatGPT's language understanding capabilities to generate code snippets or troubleshoot programming issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language Translation&lt;/strong&gt;: ChatGPT can be employed for translation tasks, breaking down language barriers and facilitating global communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tutoring and Education&lt;/strong&gt;: The AI model can be used to provide explanations, answer questions, and support learning across various subjects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are just a few examples of the vast potential of ChatGPT. Its versatility enables it to be adapted for numerous tasks and applications, making it an invaluable tool for businesses and individuals alike.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages and Limitations
&lt;/h2&gt;

&lt;p&gt;ChatGPT offers numerous advantages, including its versatile applications, human-like text generation, and adaptability to various tasks.&lt;/p&gt;

&lt;p&gt;However, it also has limitations, such as the possibility of generating biased or incorrect information, and the need for computational resources to handle large-scale models.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;High-quality text generation that resembles human writing&lt;/li&gt;
&lt;li&gt;Extensive knowledge base due to its training on vast amounts of data&lt;/li&gt;
&lt;li&gt;Time and cost-saving benefits for businesses and individuals&lt;/li&gt;
&lt;li&gt;Wide range of applications across multiple industries&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Limitations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Limited knowledge with a cutoff date (in this case, September 2021)&lt;/li&gt;
&lt;li&gt;Possibility of generating incorrect or nonsensical information&lt;/li&gt;
&lt;li&gt;Potential for bias based on the training data&lt;/li&gt;
&lt;li&gt;Requires significant computational resources for training and deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Ethical Considerations
&lt;/h3&gt;

&lt;p&gt;As with any AI technology, ChatGPT presents ethical challenges that must be addressed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;AI Bias&lt;/strong&gt;: ChatGPT may inadvertently produce biased content based on the data it has been trained on. It's crucial to develop mechanisms for detecting and mitigating such biases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Misinformation&lt;/strong&gt;: Since ChatGPT can generate incorrect information, users should always verify generated content for accuracy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Malicious Use&lt;/strong&gt;: The technology may be exploited for nefarious purposes, such as generating fake news or offensive content. OpenAI and other stakeholders should establish guidelines and restrictions to prevent misuse.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Future of ChatGPT
&lt;/h2&gt;

&lt;p&gt;As AI research progresses, we can expect improvements in the performance and capabilities of ChatGPT. Some potential future developments include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expansion of knowledge and reduction of knowledge gaps&lt;/li&gt;
&lt;li&gt;Better handling of ambiguous or complex user inputs&lt;/li&gt;
&lt;li&gt;Enhanced context understanding and long-term memory&lt;/li&gt;
&lt;li&gt;Integration with other AI technologies for seamless, end-to-end solutions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;ChatGPT has proven to be a groundbreaking innovation in the world of AI and natural language processing. With its human-like text generation capabilities and wide range of applications, it has the potential to revolutionize communication and interactions with technology.&lt;/p&gt;

&lt;p&gt;However, it's essential to address the ethical concerns and limitations associated with ChatGPT to ensure responsible and effective use in the future. As AI research continues to advance, we can look forward to even more refined and powerful language models that further transform the way we interact with technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples of ChatGPT in Action
&lt;/h2&gt;

&lt;p&gt;To better understand the capabilities of ChatGPT, let's explore some real-world examples where the AI model demonstrates its potential:&lt;/p&gt;

&lt;h3&gt;
  
  
  Content Creation
&lt;/h3&gt;

&lt;p&gt;Imagine you're a content creator looking for ideas on how to promote a new eco-friendly product. ChatGPT can help you brainstorm catchy headlines or social media captions, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Introducing the Ultimate Green Solution for Your Home: Say Hello to [Product Name]!"&lt;/li&gt;
&lt;li&gt;"Transform Your Lifestyle with [Product Name]: Sustainability Meets Innovation 🌿💡"&lt;/li&gt;
&lt;li&gt;"Elevate Your Eco-consciousness: Discover the Revolutionary [Product Name] Today!"&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Customer Support
&lt;/h3&gt;

&lt;p&gt;Consider a scenario where a user is having trouble resetting their password on a website. A ChatGPT-powered chatbot can guide them through the process:&lt;/p&gt;

&lt;blockquote&gt;
User: I can't reset my password. Can you help me?

ChatGPT Chatbot: Of course! To reset your password, please follow these steps:

1. Go to the login page and click on "Forgot Password."
2. Enter your email address associated with the account and click "Submit."
3. You will receive an email with a password reset link. Click on the link.
4. Create a new password and confirm it by entering it again.
5. Click "Save" to update your password. You can now log in with your new password.
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Code Generation
&lt;/h3&gt;

&lt;p&gt;Suppose a developer is seeking assistance in creating a Python function to calculate the factorial of a given number. ChatGPT can generate a code snippet for this purpose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; \&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter a number: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The factorial of&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;is&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Language Translation
&lt;/h3&gt;

&lt;p&gt;A user needs to translate a sentence from English to Spanish. ChatGPT can provide the translated text:&lt;/p&gt;

&lt;blockquote&gt;
English: "The weather is beautiful today."

Spanish: "El tiempo está hermoso hoy."

&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Tutoring and Education
&lt;/h3&gt;

&lt;p&gt;A student is struggling to understand the concept of photosynthesis. ChatGPT can offer a simplified explanation:&lt;/p&gt;

&lt;blockquote&gt;
Photosynthesis is a process by which plants, algae, and some bacteria convert sunlight, carbon dioxide, and water into glucose (a type of sugar) and oxygen. This process allows these organisms to produce energy for their own growth and maintenance, while also releasing oxygen into the atmosphere, which is essential for life on Earth.
&lt;/blockquote&gt;

&lt;p&gt;These examples illustrate the diverse range of tasks that ChatGPT can handle, demonstrating its potential to revolutionize various aspects of our lives.&lt;/p&gt;

&lt;p&gt;By integrating ChatGPT into different applications, businesses and individuals can leverage its capabilities to improve efficiency, enhance communication, and create more engaging experiences.&lt;/p&gt;

&lt;h2&gt;
  
  
  History of ChatGPT and OpenAI: A Journey of AI Evolution
&lt;/h2&gt;

&lt;p&gt;To provide a comprehensive understanding of ChatGPT, it's essential to discuss its origins and the organization behind it, OpenAI. Understanding the historical context will not only enrich your knowledge but also help attract people searching for information on ChatGPT and OpenAI.&lt;/p&gt;

&lt;h3&gt;
  
  
  OpenAI: Pioneering the AI Revolution
&lt;/h3&gt;

&lt;p&gt;OpenAI is a leading AI research organization founded in 2015 by &lt;a href="https://twitter.com/elonmusk" rel="noopener noreferrer"&gt;Elon Musk&lt;/a&gt;, &lt;a href="https://twitter.com/sama" rel="noopener noreferrer"&gt;Sam Altman&lt;/a&gt;, and several other prominent figures in the tech industry.&lt;/p&gt;

&lt;p&gt;The organization's mission is to ensure that artificial general intelligence (AGI) benefits all of humanity. OpenAI has been at the forefront of AI research, producing groundbreaking models like GPT-2, GPT-3, and most recently, ChatGPT, based on the GPT-4 architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  GPT Series: The Evolution of Language Models
&lt;/h3&gt;

&lt;p&gt;The GPT series of language models has seen remarkable advancements since its inception:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;GPT&lt;/strong&gt;: The original Generative Pre-trained Transformer model introduced the concept of transformers, a novel architecture designed to handle long-range dependencies in text data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-2&lt;/strong&gt;: Building upon the success of GPT, GPT-2 showcased significant improvements in text generation quality, but its release was initially limited due to concerns about potential misuse.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-3&lt;/strong&gt;: The third iteration of the GPT series made headlines with its massive scale and impressive capabilities, pushing the boundaries of AI-generated text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-4 and ChatGPT&lt;/strong&gt;: As the latest evolution, GPT-4 powers ChatGPT, demonstrating even greater context understanding and human-like text generation.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  OpenAI's Collaborative Approach
&lt;/h3&gt;

&lt;p&gt;OpenAI's commitment to collaboration and openness has contributed significantly to the AI community's growth. They actively engage with researchers, developers, and businesses, providing access to their models via the OpenAI API.&lt;/p&gt;

&lt;p&gt;This approach fosters innovation and enables the development of various applications and services powered by ChatGPT and other OpenAI models.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with ChatGPT: Unleashing the Power of AI Language Models
&lt;/h2&gt;

&lt;p&gt;For individuals and businesses interested in harnessing the potential of ChatGPT, getting started is straightforward.&lt;/p&gt;

&lt;p&gt;OpenAI offers the OpenAI API, providing access to ChatGPT and enabling developers to integrate its capabilities into their projects. Here's a quick guide to help you begin your journey with ChatGPT:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Sign up for the OpenAI API&lt;/strong&gt;: Visit the OpenAI website and sign up for access to the API. Depending on your needs, you can choose from various pricing plans, including free trial options.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the documentation&lt;/strong&gt;: Familiarize yourself with the API documentation to understand how to interact with ChatGPT and other OpenAI models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Start experimenting&lt;/strong&gt;: Create sample applications or integrate ChatGPT into existing projects to explore its capabilities and potential use cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimize and refine&lt;/strong&gt;: Continuously improve your applications by fine-tuning ChatGPT's responses, addressing potential biases, and ensuring the generated content is accurate and relevant.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And that wraps up our in-depth exploration of ChatGPT and its incredible potential in transforming the way we communicate and interact with technology. I hope you found this article informative and engaging! If you enjoyed it, please feel free to browse through more articles on my blog for insights into various topics.&lt;/p&gt;

&lt;p&gt;I'd love to hear your thoughts and experiences with ChatGPT or any other AI language models you've encountered. Don't hesitate to leave a comment below, and let's keep the conversation going! I appreciate your feedback and insights, as they help make this blog an even better resource for everyone.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and happy exploring! 😊&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/chatgpt-vs-gemini-vs-grok-vs-deepseek-vs-claude/" rel="noopener noreferrer"&gt;ChatGPT vs Gemini vs Grok vs Deepseek vs Claude&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/chatgpt-vs-google-bard-vs-microsoft-bing-top-ai-models-compared/" rel="noopener noreferrer"&gt;ChatGPT vs Google Bard vs Microsoft Bing: Top AI Models Compared&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/chatgpt-vs-github-copilot-in-depth-comparison-ai-tools-showdown/" rel="noopener noreferrer"&gt;ChatGPT vs Github Copilot - In-depth Comparison | AI Tools Showdown&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/does-true-ai-exist-unraveling-the-myths-and-reality/" rel="noopener noreferrer"&gt;Does True AI Exist? Unraveling the Myths and Reality&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>openai</category>
      <category>ai</category>
    </item>
    <item>
      <title>OpenAI ChatGPT 5 vs Grok 4 - Which one creates better Python code?</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Sat, 19 Sep 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/openai-chatgpt-5-vs-grok-4-which-one-creates-better-python-code-11jb</link>
      <guid>https://dev.to/mecanik-dev/openai-chatgpt-5-vs-grok-4-which-one-creates-better-python-code-11jb</guid>
      <description>&lt;p&gt;When it comes to AI-assisted coding, &lt;strong&gt;OpenAI ChatGPT 5&lt;/strong&gt; and &lt;strong&gt;Grok 4&lt;/strong&gt; are two of the hottest tools of 2025. Both claim to write Python code with high accuracy and efficiency, but which one actually delivers cleaner, more maintainable scripts in real-world scenarios?&lt;/p&gt;

&lt;p&gt;In this article, we'll pit &lt;strong&gt;ChatGPT 5&lt;/strong&gt; and &lt;strong&gt;Grok 4&lt;/strong&gt; against each other in multiple Python challenges. We will review &lt;strong&gt;code correctness&lt;/strong&gt;, &lt;strong&gt;readability&lt;/strong&gt;, &lt;strong&gt;execution speed&lt;/strong&gt;, and &lt;strong&gt;adaptability&lt;/strong&gt; when given tricky prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Compare ChatGPT 5 and Grok 4 for Python?
&lt;/h2&gt;

&lt;p&gt;Python remains the go-to language for AI, automation, and data science. Many developers now rely on AI to accelerate their coding workflow, debug faster, and even generate full applications from scratch.&lt;/p&gt;

&lt;p&gt;While ChatGPT has long dominated this space, Grok has been gaining attention for its &lt;strong&gt;code clarity&lt;/strong&gt; and &lt;strong&gt;concise outputs&lt;/strong&gt;. Both use different training philosophies, ChatGPT's emphasis on reasoning vs. Grok's focus on brevity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing OpenAI ChatGPT 5 and Grok 4
&lt;/h2&gt;

&lt;p&gt;We will compare the two AIs in &lt;strong&gt;10 Python coding&lt;/strong&gt; test cases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Basic Script&lt;/strong&gt; (Even number sum)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Processing&lt;/strong&gt; (CSV totals)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Algorithmic Problem&lt;/strong&gt; (First non-repeating char)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Integration&lt;/strong&gt; (Bitcoin price fetch)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Scraping&lt;/strong&gt; (Hacker News headlines)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File Compression&lt;/strong&gt; (Zip .txt files)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image Processing&lt;/strong&gt; (Resize JPEGs)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multithreading&lt;/strong&gt; (Concurrent downloads)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database Interaction&lt;/strong&gt; (SQLite CRUD)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unit Testing&lt;/strong&gt; (Prime number test)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All prompts will be identical and submitted to &lt;strong&gt;ChatGPT 5&lt;/strong&gt; and &lt;strong&gt;Grok 4&lt;/strong&gt;. You can run the tests yourself to validate results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Python Challenge 1 - Basic Script
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 1 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Write a Python script that reads a list of integers and outputs the sum of even numbers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 1 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Script to read a list of integers and output the sum of even numbers
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sum_of_even_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Read input from the user
&lt;/span&gt;    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter integers separated by spaces: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;
        &lt;span class="n"&gt;total_even&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sum_of_even_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sum of even numbers:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;total_even&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Please enter valid integers only.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 1 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Read a line of input containing space-separated integers
&lt;/span&gt;&lt;span class="n"&gt;input_line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter a list of integers separated by spaces: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Convert the input string into a list of integers
&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;input_line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize sum of even numbers
&lt;/span&gt;&lt;span class="n"&gt;even_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="c1"&gt;# Iterate through the list and add even numbers to the sum
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;even_sum&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;

&lt;span class="c1"&gt;# Output the sum
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sum of even numbers:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;even_sum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 1 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Very fast response, near instant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided shorter and elegant code with entrypoint, with comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~2 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided a bit longer code and without entrypoint, but with comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 2 - Data Processing
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 2 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Load a CSV file of transactions and print the total sales per product.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 2 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;defaultdict&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;total_sales_per_product&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;csv_file&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;sales&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defaultdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;csv_file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newline&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DictReader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;product&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;product&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                &lt;span class="n"&gt;quantity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;quantity&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
                &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
                &lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;product&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;quantity&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt;
            &lt;span class="nf"&gt;except &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;KeyError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Skipping invalid row: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;file_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;transactions.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  &lt;span class="c1"&gt;# Change to your file path
&lt;/span&gt;    &lt;span class="n"&gt;sales_totals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;total_sales_per_product&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Total Sales Per Product:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;product&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;sales_totals&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;product&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: $&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;,.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 2 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="c1"&gt;# Prompt user for the CSV file path
&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter the path to the CSV file: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Load the CSV file into a DataFrame
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Assuming the CSV has columns 'Product' and 'Sales'
# Group by 'Product' and sum the 'Sales'
&lt;/span&gt;&lt;span class="n"&gt;total_sales&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Product&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Sales&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Print the total sales per product
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Total sales per product:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 2 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Very fast response, near instant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided a bit longer and elegant code with entrypoint, but without comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~13 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided simpler code and without entrypoint, but with comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 3 - Algorithmic Problem
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 3 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Given a string, return the first non-repeating character.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 3 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;first_non_repeating_char&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Counter&lt;/span&gt;
    &lt;span class="n"&gt;counts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;counts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;char&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;  &lt;span class="c1"&gt;# If no non-repeating character found
&lt;/span&gt;
&lt;span class="c1"&gt;# Example usage
&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;swiss&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;first_non_repeating_char&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;Code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The first non-repeating character is: &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;No non-repeating character found.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 3 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;first_non_repeating_char&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Returns the first non-repeating character in the string.
    If no such character exists, returns None.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;char&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

&lt;span class="c1"&gt;# Example usage
&lt;/span&gt;&lt;span class="n"&gt;input_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter a string: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;first_non_repeating_char&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input_string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;First non-repeating character:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 3 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Very fast response, near instant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided short code without an entrypoint and without comments. Example usage has a bug.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~8 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided short code without an entrypoint, with a brief docstring.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 4 - API Integration
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 4 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use the requests library to fetch the current Bitcoin price in USD from a public API and print it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 4 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_bitcoin_price_usd&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.coindesk.com/v1/bpi/currentprice/USD.json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Raise HTTPError for bad responses
&lt;/span&gt;        &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bpi&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;USD&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Current Bitcoin Price: $&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; USD&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exceptions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RequestException&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error fetching Bitcoin price: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;except &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;KeyError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error parsing response: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;get_bitcoin_price_usd&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 4 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="c1"&gt;# Define the API endpoint
&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&amp;amp;vs_currencies=usd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# Fetch the data
&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Check if the request was successful
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;bitcoin_price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bitcoin&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;usd&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Current Bitcoin price in USD: $&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;bitcoin_price&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error fetching data: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 4 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Very fast response, near instant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided short and elegant code with entrypoint, but without comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~23 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided a bit shorter code and without entrypoint but with comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 5 - Web Scraping
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 5 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use requests and BeautifulSoup to scrape the top 5 news headlines from &lt;a href="https://news.ycombinator.com/" rel="noopener noreferrer"&gt;https://news.ycombinator.com/&lt;/a&gt; and print them.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 5 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;bs4&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BeautifulSoup&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_top_hn_headlines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://news.ycombinator.com/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="n"&gt;soup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;BeautifulSoup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;html.parser&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;headlines&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_text&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;soup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;.titleline &amp;gt; a&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;

        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Top &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; Hacker News Headlines:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;headlines&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;. &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exceptions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RequestException&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error fetching Hacker News: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;get_top_hn_headlines&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 5 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;bs4&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BeautifulSoup&lt;/span&gt;

&lt;span class="c1"&gt;# Define the URL
&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;https://news.ycombinator.com/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;# Fetch the webpage
&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Raise an error for bad status codes
&lt;/span&gt;
&lt;span class="c1"&gt;# Parse the HTML content
&lt;/span&gt;&lt;span class="n"&gt;soup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;BeautifulSoup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;html.parser&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Find the top 5 story elements
&lt;/span&gt;&lt;span class="n"&gt;stories&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;soup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find_all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;tr&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;class_&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;athing&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)[:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Print the top 5 headlines
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Top 5 News Headlines from Hacker News:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;story&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stories&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;title_span&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;story&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;span&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;class_&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;titleline&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;title_span&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;headline&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;title_span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;a&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;. &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;headline&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 5 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Very fast response, near instant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided short and elegant code with entrypoint, but without comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~13 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided a bit longer code and without entrypoint but with comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 6 - File Compression
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 6 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Create a Python script that zips all .txt files in the current directory into 'archive.zip'.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 6 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;zipfile&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;glob&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;zip_text_files&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_zip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;archive.zip&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;txt_files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;txt_files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;No .txt files found in the current directory.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;zipfile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ZipFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_zip&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;zipf&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;txt_files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;zipf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;basename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Added: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Created &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;output_zip&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; containing &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;txt_files&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; files.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;zip_text_files&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 6 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;zipfile&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ZipFile&lt;/span&gt;

&lt;span class="c1"&gt;# Get the current directory
&lt;/span&gt;&lt;span class="n"&gt;current_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getcwd&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# List all .txt files in the current directory
&lt;/span&gt;&lt;span class="n"&gt;txt_files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_dir&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;endswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.txt&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;

&lt;span class="c1"&gt;# Create a zip file and add the .txt files
&lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;ZipFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;archive.zip&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;zipf&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;txt_files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;zipf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Successfully zipped &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;txt_files&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; .txt files into &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;archive.zip&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 6 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Very fast response, near instant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided short and elegant code with entrypoint, but without comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~10 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided short code and without entrypoint but with comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 7 - Image Processing
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 7 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use Pillow (PIL) to resize all JPEG images in the current directory to 800x600 pixels and save them to an 'output' folder.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 7 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;PIL&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;glob&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;resize_jpeg_images&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Create output folder if it doesn't exist
&lt;/span&gt;    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;makedirs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Find all .jpg and .jpeg files (case-insensitive)
&lt;/span&gt;    &lt;span class="n"&gt;jpeg_files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*.jpeg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*.JPG&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*.JPEG&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;jpeg_files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;No JPEG images found in the current directory.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;jpeg_files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;img_resized&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LANCZOS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;output_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;basename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="n"&gt;img_resized&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;JPEG&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Resized and saved: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;output_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error processing &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;resize_jpeg_images&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 7 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;PIL&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;

&lt;span class="c1"&gt;# Get the current directory
&lt;/span&gt;&lt;span class="n"&gt;current_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getcwd&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Create the output folder if it doesn't exist
&lt;/span&gt;&lt;span class="n"&gt;output_folder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;makedirs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_folder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# List all JPEG files in the current directory (case-insensitive)
&lt;/span&gt;&lt;span class="n"&gt;jpeg_files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_dir&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
              &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;endswith&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.jpg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.jpeg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))]&lt;/span&gt;

&lt;span class="c1"&gt;# Resize each image and save to output folder
&lt;/span&gt;&lt;span class="n"&gt;resized_count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;jpeg_files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;img_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;resized_img&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;output_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_folder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;resized_img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;resized_count&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error processing &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Successfully resized and saved &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;resized_count&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; JPEG images to the &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; folder.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 7 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Very fast response, near instant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided short and elegant code with entrypoint, with comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~10 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided a bit longer code and without entrypoint, with comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 8 - Multithreading
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 8 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Create a Python script that downloads 5 different files from given URLs concurrently using threading.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 8 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;urllib.parse&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;urlparse&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;concurrent.futures&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ThreadPoolExecutor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;as_completed&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;CHUNK_SIZE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt;  &lt;span class="c1"&gt;# 64KB
&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;unique_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dest_dir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Return a unique path inside dest_dir by appending (1), (2), ... if needed.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;dest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dest_dir&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;dest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;dest&lt;/span&gt;
    &lt;span class="n"&gt;stem&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;suffix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splitext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;candidate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dest_dir&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;stem&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; (&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;suffix&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;candidate&lt;/span&gt;
        &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;filename_from_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Get a safe filename from URL; fall back to file_{index} if missing.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;urlparse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;basename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;download_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dest_dir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Download a single file to dest_dir. Returns the saved path.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;dest_dir&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;base_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;filename_from_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;dest_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;unique_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dest_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User-Agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;python-threaded-downloader/1.0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dest_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;wb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;iter_content&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;CHUNK_SIZE&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="c1"&gt;# filter out keep-alive chunks
&lt;/span&gt;                    &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;dest_path&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;download_concurrently&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;downloads&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_workers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Download given URLs concurrently using threads.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;dest_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_dir&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="n"&gt;errors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;ThreadPoolExecutor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_workers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;max_workers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;future_to_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;download_file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dest_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;future&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;as_completed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;future_to_url&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;future_to_url&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;future&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;saved_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;future&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;result&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;✅ Downloaded: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; -&amp;gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;saved_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;saved_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;❌ Failed: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; (&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Done. &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; succeeded, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; failed.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;


&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Replace these with your 5 URLs
&lt;/span&gt;    &lt;span class="n"&gt;urls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com/file1.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com/file2.pdf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com/file3.zip&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com/file4.png&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com/file5.mp4&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nf"&gt;download_concurrently&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;downloads&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_workers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 8 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;threading&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;urllib.request&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;download_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Downloads a file from the given URL and saves it with the specified filename.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;urlretrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Downloaded &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; from &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error downloading &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# List of 5 example URLs (replace with your actual URLs)
&lt;/span&gt;&lt;span class="n"&gt;urls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://www.example.com/file1.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://www.example.com/file2.pdf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://www.example.com/file3.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://www.example.com/file4.zip&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://www.example.com/file5.docx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Corresponding filenames to save the downloads
&lt;/span&gt;&lt;span class="n"&gt;filenames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file1.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file2.pdf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file3.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file4.zip&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file5.docx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Create and start threads for concurrent downloads
&lt;/span&gt;&lt;span class="n"&gt;threads&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filenames&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;thread&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;threading&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;download_file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;threads&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Wait for all threads to complete
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;thread&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;threads&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;All downloads completed.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 8 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~10 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided long and elegant code with entrypoint, with comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Even slower response, "thought" a bit longer (~21 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided shorter code and without entrypoint, with comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 9 - Database Interaction
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 9 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Connect to an SQLite database, create a 'users' table, insert sample data, and query all users.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 9 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="c1"&gt;# Connect to (or create) the database
&lt;/span&gt;    &lt;span class="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;example.db&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;cursor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# Create the users table if it doesn't exist
&lt;/span&gt;    &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        CREATE TABLE IF NOT EXISTS users (
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            name TEXT NOT NULL,
            email TEXT UNIQUE NOT NULL
        )
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Insert sample data
&lt;/span&gt;    &lt;span class="n"&gt;sample_users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Alice&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;alice@example.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Bob&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bob@example.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Charlie&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;charlie@example.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;executemany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSERT INTO users (name, email) VALUES (?, ?)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sample_users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IntegrityError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Ignore duplicates if run multiple times
&lt;/span&gt;        &lt;span class="k"&gt;pass&lt;/span&gt;

    &lt;span class="c1"&gt;# Commit changes
&lt;/span&gt;    &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# Query all users
&lt;/span&gt;    &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT id, name, email FROM users&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetchall&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Users in database:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Close the connection
&lt;/span&gt;    &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 9 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;

&lt;span class="c1"&gt;# Connect to an in-memory SQLite database
&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;:memory:&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cursor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Create the 'users' table
&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;
    CREATE TABLE users (
        id INTEGER PRIMARY KEY,
        name TEXT,
        age INTEGER
    )
&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Insert sample data
&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSERT INTO users (name, age) VALUES (&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Alice&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;, 30)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSERT INTO users (name, age) VALUES (&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Bob&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;, 25)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSERT INTO users (name, age) VALUES (&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Charlie&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;, 35)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Commit the changes
&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Query all users
&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM users&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetchall&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Print the results
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ID | Name | Age&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;----------------&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; | &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; | &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Close the connection
&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 9 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: Very fast response, near instant. Understood a script is needed, even though we just bluntly said "connect..." instead of "write or create".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided long and elegant code with entrypoint, with comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~16 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided a bit shorter code and, for the first time, with an entrypoint and comments. Very interestingly, several function/test names mirror ChatGPT 5’s style.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python Challenge 10 - Unit Testing
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 10 Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Write a Python unittest that verifies a function 'is_prime(n)' correctly identifies prime numbers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Challenge 10 GPT 5 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;unittest&lt;/span&gt;

&lt;span class="c1"&gt;# Example implementation of is_prime for testing purposes
# If you already have this function, you can remove this definition.
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Return True if n is a prime number, else False.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
        &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TestIsPrime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unittest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TestCase&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_primes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;primes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;29&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;primes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertTrue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; should be prime&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_non_primes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;non_primes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;non_primes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertFalse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; should not be prime&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;unittest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 10 Grok 4 Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;unittest&lt;/span&gt;

&lt;span class="c1"&gt;# Assuming the is_prime function is defined in a module named prime_checker
# Replace 'prime_checker' with the actual module name where is_prime is defined
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;prime_checker&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;is_prime&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TestIsPrime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unittest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TestCase&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_prime_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Test that prime numbers are correctly identified.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;primes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;29&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;primes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertTrue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; should be prime&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_non_prime_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Test that non-prime numbers are correctly identified.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;non_primes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;26&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;27&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;non_primes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertFalse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; should not be prime&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_negative_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Test that negative numbers are not considered prime.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;negatives&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;negatives&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertFalse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; should not be prime&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_one_and_zero&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Explicitly test 0 and 1, which are not prime.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertFalse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertFalse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;unittest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Challenge 10 Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Speed&lt;/strong&gt;: very fast response, near instant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT 5 Code&lt;/strong&gt;: Provided long and elegant code with entrypoint, with comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Speed&lt;/strong&gt;: Slower response, "thought" a bit longer (~12 seconds).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 Code&lt;/strong&gt;: Provided a bit shorter code and for the first time with entrypoint and comments. Very interestingly the function names are the as ChatGPT 5.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Criteria for Evaluation
&lt;/h2&gt;

&lt;p&gt;We will rate each AI on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code Correctness&lt;/strong&gt;: Does it work without major edits?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Readability&lt;/strong&gt;: Is the code clean and well-commented?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficiency&lt;/strong&gt;: Does it use optimal methods?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error Handling&lt;/strong&gt;: Does it anticipate possible failures?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explainability&lt;/strong&gt;: Does it provide clear reasoning?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Preliminary Observations
&lt;/h2&gt;

&lt;p&gt;From previous and current experience:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ChatGPT 5&lt;/strong&gt; tends to give more verbose, well-documented code, much faster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4&lt;/strong&gt; prefers minimalism and slower responses and sometimes omits comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both excel at standard tasks, but Grok may struggle with multi-step reasoning prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  What stood out across the 10 challenges
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prompt adherence&lt;/strong&gt;: GPT-5 stayed on-task (e.g., BTC API). Grok 4 occasionally drifted (Challenge 4).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Entrypoints &amp;amp; structure&lt;/strong&gt;: GPT-5 consistently used entrypoints and helpers; Grok 4 often wrote single-file scripts without an entrypoint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error handling&lt;/strong&gt;: GPT-5 added timeouts/raise_for_status/try-except more often; Grok 4 tended to be minimal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependencies &amp;amp; assumptions&lt;/strong&gt;: GPT-5 used stdlib where possible; Grok 4 leaned on pandas or simpler urllib defaults.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data model assumptions&lt;/strong&gt;: GPT-5 inferred fields and computed values (qty × price); Grok 4 assumed pre-aggregated columns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Algorithmic care&lt;/strong&gt;: Both solved the logic tasks; GPT-5's example had a minor variable bug, while Grok 4's HN example had syntax typos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance posture&lt;/strong&gt;: GPT-5 used streaming + thread pools for downloads; Grok 4 used raw threads + urlretrieve (simpler, less robust).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Verdict
&lt;/h2&gt;

&lt;p&gt;While both tools can write functional Python code, the choice may come down to &lt;strong&gt;developer preference&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose &lt;strong&gt;ChatGPT 5&lt;/strong&gt; if you value &lt;strong&gt;detailed explanations&lt;/strong&gt;, &lt;strong&gt;step-by-step reasoning&lt;/strong&gt;, &lt;strong&gt;fast code generation&lt;/strong&gt; and &lt;strong&gt;extensive comments&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Grok 4&lt;/strong&gt; if you prefer &lt;strong&gt;concise&lt;/strong&gt;, &lt;strong&gt;simple code&lt;/strong&gt; with minimal fluff and &lt;strong&gt;slower code generation&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I honestly prefer &lt;strong&gt;ChatGPT 5&lt;/strong&gt; because it responds much faster with better and detailed &lt;strong&gt;Python&lt;/strong&gt; code. Sorry Elon Musk.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/cloudflare-workers-ai-agent/" rel="noopener noreferrer"&gt;Building AI Agents with Cloudflare Workers and LangChain&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/ai-software-development-a-uk-business-guide-for-2026/" rel="noopener noreferrer"&gt;AI Software Development - A UK Business Guide for 2026&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/claude-opus-4-8-vs-gpt-5-api/" rel="noopener noreferrer"&gt;Claude Opus 4.8 vs. OpenAI GPT-5: Which API is Best?&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/claude-api-vs-openai-api-for-developers/" rel="noopener noreferrer"&gt;Claude API vs OpenAI API: A Developer's Comparison 2026&lt;/a&gt;., &lt;a href="https://mecanik.dev/en/posts/a-fast-utf-8-aware-c-tokenizer-for-nlp-ml/" rel="noopener noreferrer"&gt;A Fast, UTF-8 Aware C++ Tokenizer for NLP &amp;amp; ML&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/password-managers-unlocking-online-security-comprehensive-guide/" rel="noopener noreferrer"&gt;Password Managers: Unlocking Online Security | Comprehensive Guide&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions (FAQ)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is OpenAI ChatGPT 5 or Grok 4 better for beginners?&lt;/strong&gt;&lt;br&gt;
ChatGPT 5. It explains more, includes safer defaults (timeouts, error handling), and uses cleaner structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which produced fewer code issues in these tests?&lt;/strong&gt;&lt;br&gt;
ChatGPT 5 overall. Grok 4 had occasional prompt drift and minor syntax errors in scraping.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which is faster?&lt;/strong&gt;&lt;br&gt;
In your runs, ChatGPT 5 responded faster on average. Your timings are included per challenge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I need to review the code they generate?&lt;/strong&gt;&lt;br&gt;
Yes. Both models can make small mistakes; always run tests and add guardrails for I/O and network code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which handled files, images, and networking more robustly?&lt;/strong&gt;&lt;br&gt;
ChatGPT 5. It tended to add entrypoints, timeouts, streaming, and better image resampling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does Grok 4 have advantages?&lt;/strong&gt;&lt;br&gt;
Yes, snappier, concise scripts when you already know the context and want minimal output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What prompt style worked best?&lt;/strong&gt;&lt;br&gt;
Be explicit about inputs/outputs, libraries, and edge cases (example: 'use requests with timeout, print JSON parse errors').&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I rely on either model for production code?&lt;/strong&gt;&lt;br&gt;
Use them as accelerators, not replacements: keep tests, linting, and security reviews in your pipeline.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>chatgpt</category>
      <category>openai</category>
      <category>grok</category>
    </item>
    <item>
      <title>WordPress Performance Audit: Pass Mobile Vitals Guide</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Fri, 18 Sep 2026 18:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/wordpress-performance-audit-pass-mobile-vitals-guide-jag</link>
      <guid>https://dev.to/mecanik-dev/wordpress-performance-audit-pass-mobile-vitals-guide-jag</guid>
      <description>&lt;p&gt;Commissioning a professional WordPress performance audit is the most effective way to identify page speed bottlenecks on mobile devices in 2026. While desktop users rarely notice minor asset loading delays, mobile visitors suffer from slow 3G/4G connections and limited device processor speeds. A high Largest Contentful Paint (LCP) or Interaction to Next Paint (INP) score can trigger high bounce rates, which directly harms your conversion rates. This guide details the scoping phases, diagnostic tools, and database cleanup methods used in a technical audit.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Mobile Performance Recommendation:&lt;/strong&gt; Always configure your caching plugin to generate separate cache pools for mobile layout displays. Bypassing this step can serve desktop-sized images and unoptimised script blocks to mobile users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaways:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A thorough audit isolates plugin overhead, unoptimised themes, and query blocks.&lt;/li&gt;
&lt;li&gt;High mobile LCP is caused by large hero images, uncompressed web fonts, and render-blocking scripts.&lt;/li&gt;
&lt;li&gt;Resolving database table overhead improves query latency and speeds up back-end server responses.&lt;/li&gt;
&lt;li&gt;Page speed improvements directly lower Google Ads acquisition costs and boost organic SEO ranks.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Technical Elements of a WordPress Audit
&lt;/h2&gt;

&lt;p&gt;A technical performance audit evaluates more than just frontend scores. According to guidelines from &lt;a href="https://pagespeed.web.dev/" rel="noopener noreferrer"&gt;PageSpeed Insights&lt;/a&gt;, server-side latency and database queries dictate the initial time-to-first-byte (TTFB) metrics. Therefore, the audit team profiles the CMS across three distinct engineering layers:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Database Table Bloat and Query Profiling
&lt;/h3&gt;

&lt;p&gt;Over time, WordPress databases accumulate technical trash in the &lt;code&gt;wp_options&lt;/code&gt; table.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Autoloaded Options:&lt;/strong&gt; Unused plugins often leave behind autoloaded options that load into server memory on every visit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transients Accumulation:&lt;/strong&gt; Obsolete API session logs and cache transients slow down database queries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Post Revision Storage:&lt;/strong&gt; Storing hundreds of post revisions bloats the database size, increasing query execution times.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Plugin Overhead and Script Enqueuing
&lt;/h3&gt;

&lt;p&gt;Installing too many plugins is a primary cause of mobile slowdowns. Many plugins also load their CSS and JavaScript files on pages where they are not used. To counter this, the audit traces enqueue scripts to identify and dequeue unnecessary assets, which prevents server-side query blocks and resource starvation.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Theme Assets and Render-Blocking CSS
&lt;/h3&gt;

&lt;p&gt;Legacy themes use heavy page builder layouts that generate nested HTML structures and load bloated CSS frameworks. The mobile browser must then spend valuable main-thread CPU cycles parsing this code before rendering any text, so this layout bloat has to be cleaned up to pass mobile vitals.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prerequisites: Your Audit Toolkit
&lt;/h2&gt;

&lt;p&gt;Before you touch a single setting, assemble the tools that turn guesswork into evidence. A repeatable audit relies on the same short list every time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PageSpeed Insights&lt;/strong&gt; – Google's public tool at &lt;a href="https://pagespeed.web.dev/" rel="noopener noreferrer"&gt;pagespeed.web.dev&lt;/a&gt; combines lab results with real-world CrUX field data for any public URL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chrome DevTools Lighthouse&lt;/strong&gt; – runs local, throttled audits and pinpoints the exact LCP element and the long tasks blocking the main thread.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Query Monitor&lt;/strong&gt; – a free WordPress plugin that surfaces slow database queries, duplicate hooks, and the specific plugins responsible for each request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WP-CLI&lt;/strong&gt; – command-line access for scripted database cleanups and bulk operations without loading the admin UI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A staging clone and a full backup&lt;/strong&gt; – never profile-and-purge on production. Snapshot the database and files first so every change is reversible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You will also need administrator access, SSH or a hosting control panel for cache and header changes, and permission to edit &lt;code&gt;wp-config.php&lt;/code&gt; and the active theme. Confirm the host runs PHP 8.1 or newer, since older runtimes inflate server response times regardless of front-end tuning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading a PageSpeed Insights Report Field by Field
&lt;/h2&gt;

&lt;p&gt;Run your worst-performing mobile URL through PageSpeed Insights and read it top to bottom rather than fixating on the headline score. Work through these fields in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Field data first.&lt;/strong&gt; The top panel shows LCP, INP, and CLS drawn from the Chrome User Experience Report, aggregated at the 75th percentile over a rolling 28-day window. This is what Google ranks on; the lab score beneath it is only a diagnostic proxy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identify the LCP element.&lt;/strong&gt; Open the &lt;em&gt;Largest Contentful Paint element&lt;/em&gt; audit to see precisely which node — usually the hero image or main heading — is being measured. Everything you do to improve LCP targets that one element.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Break LCP into its four phases:&lt;/strong&gt; time-to-first-byte, resource load delay, resource load time, and element render delay. A slow TTFB points at hosting or caching, whereas a long load delay usually means the browser discovered the image too late.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scan the opportunities.&lt;/strong&gt; &lt;em&gt;Eliminate render-blocking resources&lt;/em&gt;, &lt;em&gt;Reduce unused JavaScript&lt;/em&gt;, &lt;em&gt;Properly size images&lt;/em&gt;, and &lt;em&gt;Avoid enormous network payloads&lt;/em&gt; map directly to the plugin and theme bloat found earlier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the diagnostics.&lt;/strong&gt; &lt;em&gt;Reduce initial server response time&lt;/em&gt; and the main-thread work report explain poor INP, which is driven by JavaScript execution blocking user input.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To reproduce these results locally under controlled throttling, run Lighthouse from the command line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; lighthouse

lighthouse https://example.com/ &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--form-factor&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mobile &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--throttling-method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;simulate &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--only-categories&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;performance &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;html &lt;span class="nt"&gt;--output-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;./mobile-audit.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simulated mobile throttling — a mid-tier Android on a slow 4G profile — exposes the render-blocking and main-thread problems that never surface on a fast desktop connection.&lt;/p&gt;




&lt;p&gt;Once diagnostics are complete, developers should work through these optimisation phases to pass Core Web Vitals on mobile. The four steps below deliver the biggest gains:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deploy Modern Formats:&lt;/strong&gt; Convert JPG/PNG images to WebP or AVIF formats and configure lazy-loading protocols.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implement Critical CSS:&lt;/strong&gt; Inline the styling required for above-the-fold content, delaying secondary CSS loads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimise Web Fonts:&lt;/strong&gt; Host fonts locally on your server or CDN, and apply the &lt;code&gt;font-display: swap&lt;/code&gt; CSS rule.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Utilise Edge Caching:&lt;/strong&gt; Configure edge worker networks (like Cloudflare Pages or Page Rules) to serve HTML segments from cache. This also speeds up initial document response times.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Applying the Fixes: Configuration Examples
&lt;/h2&gt;

&lt;p&gt;With the culprits identified, the remedies live in three places: the database, &lt;code&gt;wp-config.php&lt;/code&gt;, and your server or edge cache.&lt;/p&gt;

&lt;p&gt;Start by trimming the database. These WP-CLI commands clear the most common sources of &lt;code&gt;wp_options&lt;/code&gt; and revision bloat, then report the heaviest autoloaded rows so you can target them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Remove all post revisions site-wide&lt;/span&gt;
wp post delete &lt;span class="si"&gt;$(&lt;/span&gt;wp post list &lt;span class="nt"&gt;--post_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;revision &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ids&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="nt"&gt;--force&lt;/span&gt;

&lt;span class="c"&gt;# Purge expired transients left behind by plugins&lt;/span&gt;
wp transient delete &lt;span class="nt"&gt;--expired&lt;/span&gt;

&lt;span class="c"&gt;# List the 20 largest autoloaded options (loaded on every request)&lt;/span&gt;
wp db query &lt;span class="s2"&gt;"SELECT option_name, LENGTH(option_value) AS bytes
  FROM wp_options WHERE autoload = 'yes'
  ORDER BY bytes DESC LIMIT 20;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, stop the bloat returning. Add these constants to &lt;code&gt;wp-config.php&lt;/code&gt;, above the &lt;code&gt;/* That's all, stop editing! */&lt;/code&gt; line, to cap revisions, slow the autosave, and empty the trash weekly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nb"&gt;define&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'WP_POST_REVISIONS'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;define&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'AUTOSAVE_INTERVAL'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;define&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'EMPTY_TRASH_DAYS'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now address the front end. The single highest-impact LCP change most audits miss is telling the browser to fetch the hero image immediately instead of discovering it late in the parse. Preload it with a high priority in your theme header, and never mark the above-the-fold hero &lt;code&gt;loading="lazy"&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"preload"&lt;/span&gt; &lt;span class="na"&gt;as=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt;
      &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/wp-content/uploads/2026/hero.avif"&lt;/span&gt;
      &lt;span class="na"&gt;fetchpriority=&lt;/span&gt;&lt;span class="s"&gt;"high"&lt;/span&gt;
      &lt;span class="na"&gt;media=&lt;/span&gt;&lt;span class="s"&gt;"(max-width: 600px)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, cache aggressively at the edge. Versioned assets with hashed filenames can be cached for a year; HTML should be cached briefly and revalidated. This Nginx block sets a long, immutable lifetime for static files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;location&lt;/span&gt; &lt;span class="p"&gt;~&lt;/span&gt;&lt;span class="sr"&gt;*&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="s"&gt;.(?:css|js|woff2|avif|webp|png|jpe?g|svg)&lt;/span&gt;$ &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;add_header&lt;/span&gt; &lt;span class="s"&gt;Cache-Control&lt;/span&gt; &lt;span class="s"&gt;"public,&lt;/span&gt; &lt;span class="s"&gt;max-age=31536000,&lt;/span&gt; &lt;span class="s"&gt;immutable"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Behind Cloudflare, mirror this with a Cache Rule that sets a long Edge Cache TTL for static assets while keeping a shorter Browser Cache TTL for HTML, so mobile visitors are served from the nearest data centre rather than your origin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Pitfalls and How to Troubleshoot Them
&lt;/h2&gt;

&lt;p&gt;Most audits stall on the same avoidable mistakes. Watch for these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lazy-loading the LCP image.&lt;/strong&gt; Page builders often add &lt;code&gt;loading="lazy"&lt;/code&gt; to every image, including the hero, which delays the most important paint. Remove lazy-loading above the fold and add &lt;code&gt;fetchpriority="high"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minification breaking scripts.&lt;/strong&gt; Aggressive JavaScript concatenation can reorder dependencies and throw a &lt;code&gt;$ is not a function&lt;/code&gt; console error. Re-test after enabling combine/minify and exclude jQuery or the offending handle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deferred scripts breaking interactivity.&lt;/strong&gt; Deferring or async-loading scripts that expect synchronous jQuery can break sliders and menus. Exclude interactive scripts, then test each control by hand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TTFB still high after caching.&lt;/strong&gt; If server response time barely moves, your page cache is being bypassed — usual causes are logged-in cookies, an uncached &lt;code&gt;admin-ajax.php&lt;/code&gt; call, or a cache that never warms. Confirm with the response header (&lt;code&gt;cf-cache-status: HIT&lt;/code&gt; or &lt;code&gt;x-cache: HIT&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stale critical CSS.&lt;/strong&gt; Critical CSS inlined before a theme change causes a flash of unstyled content. Regenerate it whenever the above-the-fold layout changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Serving desktop cache to mobile.&lt;/strong&gt; Without a separate mobile cache pool, visitors receive desktop-sized markup — the exact issue flagged at the top of this guide.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a change makes things worse, roll back one variable at a time on staging and re-run Lighthouse. Chasing several fixes at once makes it impossible to attribute a regression.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Verify Your LCP and INP Actually Improved
&lt;/h2&gt;

&lt;p&gt;Lab tools tell you whether a fix &lt;em&gt;should&lt;/em&gt; work; only field data confirms real mobile users felt it. Because CrUX aggregates a rolling 28-day window, expect field scores to shift over two to four weeks, not overnight. Measure against Google's official thresholds, all assessed at the 75th percentile:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Good&lt;/th&gt;
&lt;th&gt;Needs improvement&lt;/th&gt;
&lt;th&gt;Poor&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;LCP&lt;/strong&gt; (loading)&lt;/td&gt;
&lt;td&gt;≤ 2.5 s&lt;/td&gt;
&lt;td&gt;2.5 – 4.0 s&lt;/td&gt;
&lt;td&gt;&amp;gt; 4.0 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;INP&lt;/strong&gt; (interactivity)&lt;/td&gt;
&lt;td&gt;≤ 200 ms&lt;/td&gt;
&lt;td&gt;200 – 500 ms&lt;/td&gt;
&lt;td&gt;&amp;gt; 500 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;CLS&lt;/strong&gt; (visual stability)&lt;/td&gt;
&lt;td&gt;≤ 0.10&lt;/td&gt;
&lt;td&gt;0.10 – 0.25&lt;/td&gt;
&lt;td&gt;&amp;gt; 0.25&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Track progress across three sources: the PageSpeed Insights field panel for a single URL, the Core Web Vitals report in &lt;a href="https://search.google.com/search-console" rel="noopener noreferrer"&gt;Google Search Console&lt;/a&gt; for site-wide trends grouped by URL pattern, and your own real-user monitoring. To capture genuine mobile INP and LCP from live visitors, add Google's open-source &lt;code&gt;web-vitals&lt;/code&gt; library to your footer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onLCP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onINP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onCLS&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://unpkg.com/web-vitals@4?module&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;onLCP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendBeacon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/vitals&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
  &lt;span class="nf"&gt;onINP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendBeacon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/vitals&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
  &lt;span class="nf"&gt;onCLS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendBeacon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/vitals&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A genuinely passing result is one where the 75th-percentile LCP sits comfortably under 2.5 seconds and INP under 200 milliseconds on mobile — sustained across a full CrUX window, not just a single lucky lab run.&lt;/p&gt;




&lt;h2&gt;
  
  
  Financial Impact of Mobile Speed Optimisation
&lt;/h2&gt;

&lt;p&gt;Improving mobile page speeds yields a direct business return on investment. The following table highlights the impact of speed improvements:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Audit Parameter&lt;/th&gt;
&lt;th&gt;Before Optimisation&lt;/th&gt;
&lt;th&gt;After Optimisation&lt;/th&gt;
&lt;th&gt;Expected Business ROI&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Mobile LCP (Largest Image)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4.8 Seconds (Poor)&lt;/td&gt;
&lt;td&gt;1.8 Seconds (Good)&lt;/td&gt;
&lt;td&gt;Lower bounce rates, higher organic search visibility&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Mobile INP (Interaction Delay)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;350 Milliseconds (Poor)&lt;/td&gt;
&lt;td&gt;80 Milliseconds (Good)&lt;/td&gt;
&lt;td&gt;Higher user satisfaction, improved checkout conversion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Average Mobile Conversion Rate&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.2%&lt;/td&gt;
&lt;td&gt;2.6%&lt;/td&gt;
&lt;td&gt;More than double the sales volume from current traffic&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Partner with a Vetted UK WordPress Agency
&lt;/h2&gt;

&lt;p&gt;Identifying the bottlenecks in your CMS codebase protects your digital sales funnel. Mecanik provides professional &lt;a href="https://mecanik.dev/en/wordpress-developer-for-hire/" rel="noopener noreferrer"&gt;WordPress developer for hire&lt;/a&gt; services and performance engineering through the &lt;a href="https://mecanik.dev/en/seo-audit-service/" rel="noopener noreferrer"&gt;SEO audit service&lt;/a&gt; page. We specialise in WordPress performance audits, speed optimisation, custom database cleanups, and edge-cached serverless configurations. Contact us today to schedule your scoping session.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/cloudflare-pages-static-web-app-hosting/" rel="noopener noreferrer"&gt;Host a Static Web App on Cloudflare Pages: A 2026 Guide&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/cloudflare-cdn-caching-core-web-vitals/" rel="noopener noreferrer"&gt;Optimizing Cloudflare CDN Caching Strategy for Speed&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/technical-seo-audit-cost-deliverables-pricing/" rel="noopener noreferrer"&gt;Technical SEO Audit Cost: 2026 Price and Deliverables Guide&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/cloudflare-zero-trust-enterprise-access-security/" rel="noopener noreferrer"&gt;Cloudflare Zero Trust: Enterprise Access Security Guide&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a wordpress performance audit?&lt;/strong&gt;&lt;br&gt;
A wordpress performance audit is a technical evaluation of your website to identify the elements causing slow load times, particularly on mobile. This process involves profiling database tables, checking plugin execution scripts, assessing theme assets, and measuring Core Web Vitals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does plugin count affect WordPress mobile speed?&lt;/strong&gt;&lt;br&gt;
Having many plugins slows down your site because each plugin injects its own CSS, JS, and database query scripts. Many of these assets load on every page load, bloating the total page size and blocking the browser main-thread on mobile devices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Largest Contentful Paint (LCP) and how do I fix it?&lt;/strong&gt;&lt;br&gt;
LCP measures the time it takes to render the largest visible element (usually a hero image or banner) on the screen. To fix a poor LCP, compress your images, convert files to WebP, host fonts locally, and delay non-essential scripts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is mobile optimisation harder than desktop optimisation?&lt;/strong&gt;&lt;br&gt;
Mobile devices have slower processors and rely on mobile networks (3G/4G/5G) which experience high latency. Consequently, bloated JavaScript files and unoptimised database queries that load fast on desktop cause lag and delays on mobile devices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can caching plugins solve all WordPress speed issues?&lt;/strong&gt;&lt;br&gt;
No, caching plugins only cover up structural issues like bloated database tables or unoptimised themes. To pass Core Web Vitals on mobile, you must address the root issues by optimising database tables, cleaning up code, and removing heavy plugins.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>performance</category>
      <category>webdev</category>
      <category>seo</category>
    </item>
    <item>
      <title>AI Agents for Business: What They Cost and Where They Fail</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Fri, 18 Sep 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/ai-agents-for-business-what-they-cost-and-where-they-fail-16e0</link>
      <guid>https://dev.to/mecanik-dev/ai-agents-for-business-what-they-cost-and-where-they-fail-16e0</guid>
      <description>&lt;p&gt;AI agents for business are the current version of a familiar story: a demo that works beautifully in ten minutes, followed by six months of trying to make it work reliably enough to leave unattended. The gap between those two states is where almost all the budget goes, and almost none of the marketing material describes it.&lt;/p&gt;

&lt;p&gt;An agent differs from a chatbot in one respect that matters commercially. A chatbot produces text and a human decides what to do with it. An agent takes actions, calling systems, writing records, sending messages. That difference moves the risk from embarrassment to consequence, and it is why the engineering discipline required is closer to building a payment system than to building a content tool.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Where the money actually goes:&lt;/strong&gt; the model is the cheapest part. The cost is in tool integration, evaluation harnesses, guardrails and the human handoff path. A simple internal agent runs £5,000 to £12,000, a retrieval-backed one £12,000 to £30,000, and a multi-step agent with real system access starts around £30,000 and reaches £75,000 or more once monitoring and rollback are properly built.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Where AI Agents for Business Genuinely Work
&lt;/h2&gt;

&lt;p&gt;It is worth being specific, because the honest list is shorter than the hype and more useful.&lt;/p&gt;

&lt;p&gt;Agents do well on tasks that are repetitive, bounded, and tolerant of a review step. Triaging inbound enquiries and routing them with a draft response attached. Extracting structured data from unstructured documents where a human confirms before it is committed. Reconciling records between two systems and flagging the exceptions rather than resolving them. First-line support that resolves the common cases and escalates cleanly.&lt;/p&gt;

&lt;p&gt;The pattern is that the agent handles volume and a human handles judgement. Every deployment we have seen work in production has that shape, and most of the ones that failed were attempts to remove the human entirely from a process where judgement was actually required.&lt;/p&gt;

&lt;p&gt;They do badly where a mistake is expensive and hard to detect, where the task requires knowledge that exists only in someone's head, and where the process is genuinely different every time. An agent given a task with no stable structure will produce plausible output indefinitely without ever being right, which is worse than failing visibly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Pilots Stall Between Demo and Production
&lt;/h2&gt;

&lt;p&gt;The first failure mode is arithmetic and it surprises people. If a single step in an agent's chain is reliable ninety five percent of the time, a five step task succeeds about seventy seven percent of the time, and a ten step task about sixty percent. Nobody notices this in a demo because a demo runs the happy path. It becomes obvious in week three of a pilot, at which point the fix is architectural rather than a prompt change: shorten the chains, add verification between steps, and design each step so failure is detected rather than passed downstream.&lt;/p&gt;

&lt;p&gt;The second is that most business processes have no rollback. An agent that sends the wrong email cannot unsend it. An agent that updates a customer record has changed something other systems have already read. Building the ability to reverse an action is often more work than the action itself, and it is the part that gets deferred and then discovered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluation Is the Real Engineering Cost
&lt;/h2&gt;

&lt;p&gt;The third failure is evaluation, which is where the real engineering effort sits and where teams new to this consistently underestimate. Conventional software is tested against expected output. An agent produces different output each run and can be correct in several forms, so you need a graded set of realistic cases with defined criteria for acceptable behaviour, run automatically on every change. Without it you cannot tell whether a prompt adjustment improved things or moved the failure somewhere you were not looking. Expect the evaluation harness to take as long to build as the agent.&lt;/p&gt;

&lt;p&gt;The fourth is cost variance. Token spend scales with retries and chain length, so a failing agent costs more than a working one, and an agent that loops costs a great deal more. Budgets set on the assumption that average behaviour is typical behaviour tend to be wrong in the wrong direction. Our guide to &lt;a href="https://mecanik.dev/en/posts/reduce-llm-latency-prompt-caching/" rel="noopener noreferrer"&gt;reducing LLM latency and cost&lt;/a&gt; covers the caching and routing strategies that keep this bounded.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Disclosure Rules That Now Apply
&lt;/h2&gt;

&lt;p&gt;This is the part that changed recently and that most UK businesses building customer-facing agents have not registered.&lt;/p&gt;

&lt;p&gt;The EU AI Act's transparency obligations under Article 50 took effect on 2 August 2026 as originally scheduled. They require disclosure when a person is interacting with an AI system, labelling of AI-generated synthetic audio, image, video and text, and disclosure of deepfakes. Critically, these apply based on what the system does rather than which risk tier it falls into, so an ordinary customer service agent is caught.&lt;/p&gt;

&lt;p&gt;The high-risk obligations were deferred. The EU Digital Omnibus on AI, &lt;a href="https://eur-lex.europa.eu/eli/reg/2026/1744/oj" rel="noopener noreferrer"&gt;Regulation 2026/1744&lt;/a&gt;, was published in the Official Journal on 24 July 2026 and entered into force on 27 July 2026, six days before the original deadline. It moved compliance for standalone high-risk systems listed in Annex III from 2 August 2026 to 2 December 2027, and for AI embedded in products already covered by EU product safety law to 2 August 2028. The Omnibus also added two prohibited categories to Article 5, with a grace period for the associated technical safeguards running to 2 December 2026.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://artificialintelligenceact.eu/" rel="noopener noreferrer"&gt;AI Act Explorer&lt;/a&gt; is the quickest way to check which articles touch a given system. The UK has not passed an equivalent statute and continues with a regulator-led approach, so a purely domestic deployment is governed by existing law rather than a dedicated AI framework. That distinction matters less than it sounds. If you serve EU customers, or your product is used in the EU, the Act reaches you regardless of where you are incorporated, and the transparency duties are in force now rather than deferred. Building disclosure into a customer-facing agent is cheap at design time and awkward to retrofit.&lt;/p&gt;

&lt;h2&gt;
  
  
  What It Costs
&lt;/h2&gt;

&lt;p&gt;The bands below track the same structure as our wider &lt;a href="https://mecanik.dev/en/posts/ai-integration-cost-enterprise-budgeting-guide/" rel="noopener noreferrer"&gt;AI integration cost guide&lt;/a&gt;, and they describe build cost rather than running cost.&lt;/p&gt;

&lt;p&gt;An internal agent doing a single bounded task against one or two systems, with a human reviewing output, runs £5,000 to £12,000. This is the right first project and it is where you find out whether your data and processes are in a fit state.&lt;/p&gt;

&lt;p&gt;An agent with retrieval over your own documents, handling a genuine business process with several tools, runs £12,000 to £30,000. The retrieval layer is usually the larger part of that, because the quality ceiling is set by how well your documents are structured rather than by the model. Our comparison of &lt;a href="https://mecanik.dev/en/posts/fine-tuning-vs-rag-vs-prompting-cost/" rel="noopener noreferrer"&gt;fine-tuning, retrieval and prompting&lt;/a&gt; covers which approach fits which problem.&lt;/p&gt;

&lt;p&gt;A multi-step agent with write access to production systems, proper monitoring, rollback and an evaluation harness starts around £30,000 and commonly reaches £75,000 or more. The functionality is not what costs that. The safety apparatus is.&lt;/p&gt;

&lt;p&gt;Running costs are separate and more variable than vendors imply. Model calls, retrieval infrastructure, monitoring and the engineering time to maintain evaluations as the models change underneath you. Budget for the last of those explicitly, because model providers deprecate and revise on their own schedule and your agent's behaviour changes when they do.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Scope a First Project
&lt;/h2&gt;

&lt;p&gt;Pick a task where you can already measure current performance. If you do not know how long the manual process takes or how often it goes wrong, you will not be able to say whether the agent helped, and the project will be judged on impressions.&lt;/p&gt;

&lt;p&gt;Keep the first chain short. Three steps that work is a better foundation than ten that mostly work, and it teaches you the same lessons about your own data quality.&lt;/p&gt;

&lt;p&gt;Build the evaluation set before the agent. Twenty to fifty real cases with known good outcomes, written down before anyone starts prompting. This single practice separates projects that converge from projects that oscillate.&lt;/p&gt;

&lt;p&gt;Design the handoff explicitly. What happens when the agent is unsure, what the human sees, and how the case gets back into the queue. Teams that treat this as an edge case discover it is the majority of the interesting traffic.&lt;/p&gt;

&lt;p&gt;Instrument everything from the first day. You want the full input, the reasoning, the tools called and the outcome for every run, because the failures you need to understand are the ones you did not anticipate.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Not To Build One
&lt;/h2&gt;

&lt;p&gt;If the process you want to automate is stable and rule-based, conventional software is cheaper, faster, more reliable and easier to audit. A great deal of what is currently being built as agentic could be a scheduled job with some conditionals, and would be better for it.&lt;/p&gt;

&lt;p&gt;If your data is scattered, inconsistent or undocumented, fix that first. An agent inherits every problem in the underlying data and amplifies it, because it will confidently act on bad input rather than stopping.&lt;/p&gt;

&lt;p&gt;Before granting an agent write access to anything, it is worth reading the &lt;a href="https://owasp.org/www-project-top-10-for-large-language-model-applications/" rel="noopener noreferrer"&gt;OWASP Top 10 for Large Language Model Applications&lt;/a&gt;, which catalogues the failure classes that matter once a model can act rather than only answer. And if the honest answer to what happens when it gets it wrong is that nobody would notice for a week, do not give it write access. Read-only agents that draft for human approval capture most of the value at a fraction of the risk, and they are the version that survives contact with a real workload.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting a Realistic Scope
&lt;/h2&gt;

&lt;p&gt;The most common way these projects go wrong is committing to an ambitious agent before establishing whether the data and processes underneath it can support one, which is a question a short discovery answers cheaply.&lt;/p&gt;

&lt;p&gt;Mecanik builds production agents through our &lt;a href="https://mecanik.dev/en/ai-integration-services/" rel="noopener noreferrer"&gt;AI integration services&lt;/a&gt;, with the evaluation harness, monitoring and rollback treated as deliverables rather than extras, and handles the surrounding application work through our &lt;a href="https://mecanik.dev/en/services/software-development/" rel="noopener noreferrer"&gt;software development&lt;/a&gt; team. If you have a pilot that demos well and will not stabilise, that is a specific and fixable problem worth talking through.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/healthcare-software-development-uk/" rel="noopener noreferrer"&gt;Healthcare Software Development UK: Compliance and Cost&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/self-hosting-kimi-k3-hardware-cost/" rel="noopener noreferrer"&gt;Self-Hosting Kimi K3: Hardware, Cost and Sovereignty&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/third-party-api-integration-cost-failure-modes/" rel="noopener noreferrer"&gt;Third-Party API Integration: Costs and Failure Modes&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/openai-api-integration-existing-application/" rel="noopener noreferrer"&gt;OpenAI API Integration: Adding GPT to an Existing App&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between an AI agent and a chatbot?&lt;/strong&gt;&lt;br&gt;
A chatbot produces text for a human to act on. An agent takes actions itself, calling systems, writing records and sending messages. That shift moves the risk from embarrassment to consequence, so the engineering discipline required is closer to building a payment system than a content tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much do AI agents cost a UK business?&lt;/strong&gt;&lt;br&gt;
An internal agent doing a single bounded task with human review runs £5,000 to £12,000. One with retrieval over your own documents and several tools runs £12,000 to £30,000. A multi-step agent with write access to production systems, monitoring and rollback starts around £30,000 and commonly exceeds £75,000.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why do AI agent pilots fail to reach production?&lt;/strong&gt;&lt;br&gt;
Reliability compounds badly across steps, so a chain of five steps at ninety five percent each succeeds only around seventy seven percent of the time. Most business processes also have no rollback, and building an evaluation harness typically takes as long as building the agent itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I have to disclose that customers are talking to an AI?&lt;/strong&gt;&lt;br&gt;
Under the EU AI Act, Article 50 transparency obligations took effect on 2 August 2026 and require disclosure when a person interacts with an AI system, plus labelling of AI-generated content. They apply based on what the system does rather than its risk tier, and they reach businesses serving EU customers regardless of where those businesses are based.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Were the EU AI Act high-risk rules delayed?&lt;/strong&gt;&lt;br&gt;
Yes. The EU Digital Omnibus on AI, Regulation 2026/1744, entered into force on 27 July 2026 and moved obligations for standalone high-risk systems under Annex III from 2 August 2026 to 2 December 2027, and for AI embedded in regulated products to 2 August 2028. The Article 50 transparency duties were not delayed.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Backend Development in 2026 - Technologies, Costs, UK Hiring</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Thu, 17 Sep 2026 18:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/backend-development-in-2026-technologies-costs-uk-hiring-2jpi</link>
      <guid>https://dev.to/mecanik-dev/backend-development-in-2026-technologies-costs-uk-hiring-2jpi</guid>
      <description>&lt;p&gt;Backend development search interest has grown 80% to 110% across UK keyword data in the past three months, appearing in both software development and web development research categories. That dual presence tells you something important: backend skills are now in demand from businesses that have historically focused on frontend and design, as well as from the developer community itself.&lt;/p&gt;

&lt;p&gt;This guide covers the backend technology landscape in 2026, what skills and experience to look for when hiring, what it costs, and how to structure your team around backend requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python (FastAPI and Django), Node.js, and Go dominate UK backend development in 2026; each has a distinct niche rather than a clear winner across all use cases&lt;/li&gt;
&lt;li&gt;Mid-level backend developers charge £350 to £500 per day in the UK; senior developers with architecture experience command £500 to £700&lt;/li&gt;
&lt;li&gt;When hiring, test for system design thinking and the ability to explain architectural trade-offs, not language syntax knowledge&lt;/li&gt;
&lt;li&gt;AI integration experience is now a meaningful differentiator when evaluating backend candidates and agencies&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Backend Development?
&lt;/h2&gt;

&lt;p&gt;Backend development refers to the server-side layer of a software application: the logic that processes requests, stores and retrieves data, handles authentication, enforces business rules, and communicates with external services.&lt;/p&gt;

&lt;p&gt;Users do not see the backend directly, but they feel it constantly. Page load time, search accuracy, payment processing reliability, and data security are all backend concerns.&lt;/p&gt;

&lt;p&gt;In 2026, the backend encompasses several overlapping disciplines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;API development&lt;/strong&gt;: Building the interfaces that connect frontend applications, mobile apps, and third-party services to your data and business logic&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database design and management&lt;/strong&gt;: Modelling data structures, writing queries, managing migrations, and optimising performance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication and authorisation&lt;/strong&gt;: Controlling who can access what, managing sessions, tokens, and permissions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure and DevOps&lt;/strong&gt;: Deploying and scaling applications, managing containers, configuring cloud services&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration&lt;/strong&gt;: Connecting your systems to external APIs, payment processors, email providers, messaging platforms, and AI services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most backend developers specialise more heavily in one or two of these areas. Full-stack developers cover both backend and frontend but are typically stronger in one direction.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Top Backend Technologies in 2026
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Python (FastAPI, Django, Flask)
&lt;/h3&gt;

&lt;p&gt;Python has become the dominant backend language for new projects in 2026, driven by its role as the primary language for AI and machine learning. Teams building products that integrate with AI APIs naturally gravitate toward Python for the backend because the tooling, libraries, and documentation are all Python-first.&lt;/p&gt;

&lt;p&gt;FastAPI is the leading choice for high-performance REST APIs. Django remains the strongest option for full-stack web applications. Flask suits lightweight microservices and teams with existing Python expertise.&lt;/p&gt;

&lt;h3&gt;
  
  
  Node.js (Express, NestJS, Fastify)
&lt;/h3&gt;

&lt;p&gt;Node.js remains one of the most widely deployed backend platforms in the UK, particularly for real-time applications, WebSocket-heavy products, and teams where JavaScript skill sharing between frontend and backend is a priority.&lt;/p&gt;

&lt;p&gt;NestJS has matured into the enterprise-grade Node.js framework of choice, bringing structure and TypeScript-first design to a historically fragmented ecosystem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Go
&lt;/h3&gt;

&lt;p&gt;Go has established itself as the preferred language for high-performance services where low latency and efficient memory usage matter. It is the language behind much of Cloudflare's edge infrastructure, Docker, and Kubernetes. In the UK, Go backend developers command significant premiums and are harder to find than Python or Node.js specialists.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rust
&lt;/h3&gt;

&lt;p&gt;Rust backend adoption is growing in the UK, particularly for systems-level services, security-critical applications, and anywhere that memory safety is a priority without sacrificing performance. It remains a specialist skill with a steeper learning curve but is increasingly relevant to businesses migrating from legacy C++ or C systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Java and Kotlin (Spring Boot)
&lt;/h3&gt;

&lt;p&gt;Java/Spring Boot and Kotlin remain the dominant backend stack for large UK enterprises, financial services firms, and companies with long-established engineering cultures. The hire pool is large but the day rates are higher than Python or Node.js.&lt;/p&gt;

&lt;h3&gt;
  
  
  PHP (Laravel, Symfony)
&lt;/h3&gt;

&lt;p&gt;PHP powers a significant portion of the UK's web infrastructure via WordPress and Symfony-based applications. New greenfield projects in PHP are less common than five years ago, but the maintenance and extension of existing PHP codebases represents a substantial ongoing demand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Backend Developer Salaries and Hiring Costs in the UK in 2026
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Experience Level&lt;/th&gt;
&lt;th&gt;Salary (Employed)&lt;/th&gt;
&lt;th&gt;Day Rate (Contract)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Junior (0 to 2 years)&lt;/td&gt;
&lt;td&gt;£28,000 to £42,000&lt;/td&gt;
&lt;td&gt;£200 to £300/day&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mid-level (3 to 5 years)&lt;/td&gt;
&lt;td&gt;£45,000 to £65,000&lt;/td&gt;
&lt;td&gt;£350 to £500/day&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Senior (6+ years)&lt;/td&gt;
&lt;td&gt;£65,000 to £90,000&lt;/td&gt;
&lt;td&gt;£500 to £700/day&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Principal/Staff&lt;/td&gt;
&lt;td&gt;£85,000 to £130,000+&lt;/td&gt;
&lt;td&gt;£700 to £1,000+/day&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;London rates typically sit 15 to 25% above these figures. Go and Rust specialists command 20 to 30% premiums over equivalent Python or Node.js developers because of the smaller hire pool.&lt;/p&gt;

&lt;p&gt;These figures reflect direct employment and contracting. Agency placement fees for permanent roles typically add 15 to 20% of the first-year salary on top.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to Look for When Hiring a Backend Developer in the UK
&lt;/h2&gt;

&lt;p&gt;The most common hiring mistake is assessing backend developers on the wrong criteria. Here is what actually predicts performance:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;System design ability.&lt;/strong&gt; Can they architect a system that will work at your scale, be maintainable by a team, and evolve without becoming brittle? This is the most important skill and the hardest to test in a short interview.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database knowledge.&lt;/strong&gt; Many developers know how to write queries but do not understand query planning, index design, or how their data model choices affect performance at scale. Ask specific questions about a past database problem they diagnosed and resolved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security awareness.&lt;/strong&gt; A backend developer who does not think about input validation, authentication edge cases, and injection risks is a liability. Ask them to describe security considerations for a feature you are actually planning to build.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API design sensibility.&lt;/strong&gt; REST and GraphQL APIs should be intuitive, consistent, and versioned properly. Ask for examples of APIs they have designed and why they made the choices they did.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Experience with your stack.&lt;/strong&gt; Technology experience matters more at the mid and senior levels than the junior level. Switching between Python and Node.js is manageable; switching between paradigms takes time.&lt;/p&gt;

&lt;p&gt;For senior and specialist backend developers in the UK, the &lt;a href="https://mecanik.dev/en/hire-web-developer/" rel="noopener noreferrer"&gt;Mecanik hire web developer service&lt;/a&gt; covers full-stack and backend-focused engagements. For C++ and systems-level backend work specifically, the &lt;a href="https://mecanik.dev/en/hire-cpp-developer/" rel="noopener noreferrer"&gt;Mecanik hire C++ developer service&lt;/a&gt; provides specialist resource that generalist recruiters rarely carry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Backend Development for AI Integration in 2026
&lt;/h2&gt;

&lt;p&gt;One of the most in-demand backend development skills in 2026 is AI API integration. Businesses want to add AI features to their products: natural language search, document processing, code generation, content summarisation.&lt;/p&gt;

&lt;p&gt;The backend layer handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authenticating and rate-limiting calls to AI provider APIs&lt;/li&gt;
&lt;li&gt;Caching responses to reduce cost and latency&lt;/li&gt;
&lt;li&gt;Streaming responses from models to frontend clients&lt;/li&gt;
&lt;li&gt;Logging and monitoring AI usage for cost management&lt;/li&gt;
&lt;li&gt;Prompt construction and context management&lt;/li&gt;
&lt;li&gt;Error handling when AI services are degraded or rate-limited&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is backend work that requires understanding both API integration patterns and the specific behaviours of AI providers. Developers with this combination of skills are currently among the most sought-after in the UK market.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Backend development demand in the UK is growing across both software and web development categories in 2026.&lt;/li&gt;
&lt;li&gt;Python (FastAPI, Django) has become the leading choice for new backend projects, driven by AI integration demand.&lt;/li&gt;
&lt;li&gt;Senior backend developer salaries range from £65,000 to £90,000+, with contract rates of £500 to £700/day.&lt;/li&gt;
&lt;li&gt;The most important hiring criteria are system design ability, database knowledge, security awareness, and API design sensibility.&lt;/li&gt;
&lt;li&gt;AI API integration is the fastest-growing backend specialisation in the UK in 2026.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/python-web-framework-comparison-2026-django-vs-flask-vs-fastapi/" rel="noopener noreferrer"&gt;Django vs Flask vs FastAPI in 2026 - Which to Choose&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/web-development-agency-uk-how-to-choose-the-right-partner/" rel="noopener noreferrer"&gt;Web Development Agency UK - How to Choose the Right Partner&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/how-to-build-a-web-app-in-2026-the-uk-developers-guide/" rel="noopener noreferrer"&gt;How to Build a Web App in 2026 - The UK Developer's Guide&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/how-to-hire-a-software-developer-in-the-uk-in-2026/" rel="noopener noreferrer"&gt;How to Hire a Software Developer in the UK in 2026&lt;/a&gt;., &lt;a href="https://mecanik.dev/en/posts/node.js-vs-python-which-backend-language-to-choose-in-2026/" rel="noopener noreferrer"&gt;Node.js vs Python - Which Backend Language to Choose in 2026&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions (FAQ)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is the most in-demand backend language in the UK in 2026?&lt;/strong&gt;&lt;br&gt;
Python leads for new projects, particularly those involving AI integration. Node.js remains very widely deployed. Java/Kotlin dominates enterprise and financial services. Go is the premium choice for high-performance services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much does a backend developer cost in the UK?&lt;/strong&gt;&lt;br&gt;
Mid-level developers earn £45,000 to £65,000 as employees or £350 to £500 per day as contractors. Senior developers earn £65,000 to £90,000 employed or £500 to £700/day contracting. London rates run 15 to 25% higher.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between a backend developer and a full-stack developer?&lt;/strong&gt;&lt;br&gt;
A backend developer specialises in server-side logic, APIs, databases, and infrastructure. A full-stack developer covers both backend and frontend. Full-stack developers are often more versatile but less deep in either area. For complex backend challenges, a specialist backend developer is typically the stronger choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I need a backend developer if I am using a no-code platform?&lt;/strong&gt;&lt;br&gt;
It depends on what you are building. No-code platforms handle simple use cases well but have limits around custom logic, security requirements, performance, and integration complexity. Once you hit those limits, backend development becomes necessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does it take to build a backend API?&lt;/strong&gt;&lt;br&gt;
A simple REST API with a few endpoints and a database takes one to three weeks for an experienced developer. A production-grade API with authentication, authorisation, caching, rate limiting, monitoring, and documentation takes two to four months for a small team.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What should I look for in a backend code review?&lt;/strong&gt;&lt;br&gt;
Security: input validation, authentication, authorisation, SQL injection prevention. Performance: inefficient queries, missing indexes, blocking operations in async contexts. Maintainability: clear naming, separation of concerns, test coverage. Error handling: graceful degradation, appropriate logging, meaningful error messages.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>programming</category>
      <category>webdev</category>
      <category>python</category>
    </item>
    <item>
      <title>Custom API Development Cost: What You Pay For in 2026</title>
      <dc:creator>Mecanik1337</dc:creator>
      <pubDate>Thu, 17 Sep 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/mecanik-dev/custom-api-development-cost-what-you-pay-for-in-2026-26b1</link>
      <guid>https://dev.to/mecanik-dev/custom-api-development-cost-what-you-pay-for-in-2026-26b1</guid>
      <description>&lt;p&gt;Anyone estimating custom API development cost from the number of endpoints is going to be wrong, usually by a factor of three. Endpoints are the cheapest part. A dozen of them, reading and writing data you already hold, is a fortnight's work for a competent backend developer.&lt;/p&gt;

&lt;p&gt;What costs money is everything that turns those endpoints into something another company will build their business on: authentication that survives a security review, versioning that lets you change your mind later, documentation good enough that nobody emails you, and the operational apparatus that tells you which customer is having a bad morning. The gap between "we have an API" and "we have an API other people rely on" is where the budget lives.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Price bands at a glance:&lt;/strong&gt; An internal API consumed only by your own applications typically costs £10,000 to £30,000. A partner API used by a handful of named integrators generally runs £40,000 to £100,000. A public API that forms part of your product, with self-service onboarding and a published contract, starts around £100,000 and keeps costing after launch.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What You Are Actually Buying
&lt;/h2&gt;

&lt;p&gt;An API is a product with users, and it needs the things products need. Working through this list against a quote is the fastest way to see what has been left out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Design and contract.&lt;/strong&gt; Somebody has to decide the resource model, naming conventions, error format, pagination approach and filtering syntax, then write it down as a specification before implementation starts. Skipping this produces an API where three endpoints solve the same problem three different ways, and consumers notice immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication and authorisation.&lt;/strong&gt; API keys are simple and appropriate for internal use. Partner and public APIs generally need a proper token-based flow with scopes, expiry and rotation, plus per-consumer permissions enforced on every request rather than assumed from the key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rate limiting and quotas.&lt;/strong&gt; Per-consumer limits protect your infrastructure from one integrator's runaway job. They also need to be communicated in response headers so that well-behaved clients can back off, and they need an override path for the customer who legitimately needs more.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Parts Consumers Judge You On
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Documentation.&lt;/strong&gt; A generated reference is table stakes. What consumers actually need is a getting-started guide, authentication walkthrough, worked examples in a couple of languages and a changelog. Good documentation is a genuine deliverable measured in weeks, and it is the difference between an API that adopts itself and one that generates support tickets forever.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A sandbox.&lt;/strong&gt; Partners will not test against production, and you should not want them to. A test environment with realistic data, resettable state and the same validation rules is one of the most commonly omitted line items in an API quote, and one of the most frequently demanded features after launch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observability.&lt;/strong&gt; You need to see request volumes, error rates and latency broken down by consumer, because "the API is slow" is only actionable if you can tell whose requests are slow. Correlation identifiers that let you trace one customer's failing call through your logs will repay their cost in the first month of support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing.&lt;/strong&gt; Beyond unit tests, an API needs contract tests that fail the build when a response shape changes unintentionally. That safety net is what lets you keep developing without breaking the integrators who trusted you.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Three Tiers, and Why They Differ So Much
&lt;/h2&gt;

&lt;p&gt;The same set of endpoints costs very different amounts depending on who consumes them, because the audience determines the tolerance for imperfection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Internal APIs&lt;/strong&gt; serve your own applications. Your team controls both ends, breaking changes can be coordinated, documentation can be terse and authentication can rely on network boundaries. Typical cost: £10,000 to £30,000 for a well-built service with sensible tests and monitoring.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Partner APIs&lt;/strong&gt; serve a known set of external organisations. Now you need real authentication, meaningful error messages, a sandbox, written documentation and a versioning policy, because you cannot deploy a breaking change on a Tuesday afternoon and expect everyone to keep up. Typical cost: £40,000 to £100,000 depending on the number of resources and the strictness of the security requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Public or product APIs&lt;/strong&gt; serve anyone who signs up. Self-service registration, key management, published rate limits, a status page, usage-based metering, comprehensive documentation and a support process all become necessary. If billing depends on usage, you have added a metering and reconciliation system too. Typical cost: £100,000 upwards, and the launch is the beginning of the spend rather than the end.&lt;/p&gt;

&lt;p&gt;Deciding honestly which tier you are building is the most valuable half hour in the project. Most cost overruns in this category come from scoping an internal API and then discovering, three months in, that a partner was always going to use it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where Custom API Development Cost Actually Goes
&lt;/h2&gt;

&lt;p&gt;For a partner-grade API, effort distributes in a fairly predictable way, and it is rarely what stakeholders expect.&lt;/p&gt;

&lt;p&gt;Roughly a fifth goes into design and specification, including the arguments about resource naming that feel wasteful and prevent months of inconsistency. Another fifth or so goes into the endpoint implementation itself, which is the part everyone pictures when they approve the budget.&lt;/p&gt;

&lt;p&gt;Authentication, authorisation and rate limiting together commonly take fifteen to twenty per cent, and more if you are integrating with an existing identity provider that has opinions. Documentation, the sandbox and any client libraries take a similar share, which surprises people until they try to write a good getting-started guide.&lt;/p&gt;

&lt;p&gt;Testing, observability and deployment consume the remainder. That last quarter is the portion most likely to be cut when a deadline approaches, and cutting it is what converts a one-off build cost into a permanent support burden.&lt;/p&gt;

&lt;p&gt;For how this sits alongside the rest of a delivery budget, our &lt;a href="https://mecanik.dev/en/posts/custom-software-development-cost-budgeting-guide/" rel="noopener noreferrer"&gt;custom software development cost guide&lt;/a&gt; covers the surrounding line items.&lt;/p&gt;




&lt;h2&gt;
  
  
  Decisions That Move the Number
&lt;/h2&gt;

&lt;p&gt;A handful of choices account for most of the variance between quotes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Synchronous or asynchronous.&lt;/strong&gt; If any operation takes longer than a second or two, you need a job model: accept the request, return a reference, and let the consumer poll or receive a callback. That is a meaningfully larger build than a simple request and response, and offering webhooks means you are now running a delivery system with retries, signature verification and a dead-letter store of its own.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multi-tenancy.&lt;/strong&gt; Enforcing that one customer can never see another's data is straightforward to describe and easy to get subtly wrong. Doing it properly, with authorisation checked at the data access layer rather than in each controller, adds cost and is not optional.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compliance obligations.&lt;/strong&gt; Handling personal data, payment details or health information brings audit logging, retention rules, encryption requirements and evidence gathering. These are rarely in an initial estimate and are never negotiable later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Service level commitments.&lt;/strong&gt; An API with a contractual availability target needs redundancy, alerting and someone on call. That is an operating cost, not a build cost, and it should be quoted separately so nobody is surprised.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Existing foundations.&lt;/strong&gt; Building on a codebase that already has authentication, background jobs and monitoring is dramatically cheaper than starting from nothing. If you need the underlying platform as well, our walkthrough on &lt;a href="https://mecanik.dev/en/posts/building-a-serverless-api-with-cloudflare-workers/" rel="noopener noreferrer"&gt;building a serverless API with Cloudflare Workers&lt;/a&gt; shows an approach that keeps the infrastructure cost low.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Costs That Arrive After Launch
&lt;/h2&gt;

&lt;p&gt;An API is a promise, and promises have running costs.&lt;/p&gt;

&lt;p&gt;Versioning is the largest of them. Once external consumers depend on your response shapes, you cannot change them freely. Maintaining two versions in parallel while integrators migrate is normal, and it means every bug fix has to be applied twice for a period. A published deprecation policy with generous notice makes this manageable; the absence of one makes every improvement a negotiation.&lt;/p&gt;

&lt;p&gt;Support is the second. Even excellent documentation generates questions, and the questions are technical enough that they reach a developer rather than stopping at a service desk. Budget real engineering time for this, particularly in the months after each new partner goes live.&lt;/p&gt;

&lt;p&gt;Documentation maintenance is the third and the most neglected. Examples that no longer work are worse than no examples, and they erode confidence faster than an outage.&lt;/p&gt;

&lt;p&gt;As a planning figure, expect fifteen to twenty-five per cent of the original build cost annually to keep a partner or public API healthy. If the API is itself a revenue line, our guide to &lt;a href="https://mecanik.dev/en/posts/software-licensing-models-enterprise-applications/" rel="noopener noreferrer"&gt;software licensing models&lt;/a&gt; covers how to structure the commercial side.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Keep the Project From Doubling
&lt;/h2&gt;

&lt;p&gt;Three habits keep API projects inside their estimate.&lt;/p&gt;

&lt;p&gt;Write the specification first and have a real consumer review it before implementation begins. An hour of feedback from the team that will actually integrate saves weeks of rework, and it exposes the requirement nobody mentioned.&lt;/p&gt;

&lt;p&gt;Build one endpoint completely, all the way through authentication, error handling, documentation, tests and monitoring, before building the other twenty. The first one reveals the true cost per endpoint, and it does so while the budget can still absorb the news.&lt;/p&gt;

&lt;p&gt;Be ruthless about the initial resource list. Most APIs launch with more endpoints than anyone uses, and every unused endpoint still needs documenting, testing, securing and versioning for as long as it exists. Ship the smallest useful surface and extend it once real usage tells you what is missing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Build an API People Want to Integrate With
&lt;/h2&gt;

&lt;p&gt;Mecanik designs and builds APIs as part of our &lt;a href="https://mecanik.dev/en/services/software-development/" rel="noopener noreferrer"&gt;custom software development services&lt;/a&gt;, from internal services through to public product APIs with self-service onboarding. We treat the specification, documentation and sandbox as deliverables rather than afterthoughts, because those are what determine whether anyone successfully integrates.&lt;/p&gt;

&lt;p&gt;If you are on the other side of this problem and consuming somebody else's API rather than publishing your own, our guide to &lt;a href="https://mecanik.dev/en/posts/third-party-api-integration-cost-failure-modes/" rel="noopener noreferrer"&gt;third-party API integration&lt;/a&gt; covers what to watch for. Otherwise, tell us who the consumers are and what they need to do, and we will scope it tier by tier so you can see exactly what each level of ambition costs.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt; &lt;a href="https://mecanik.dev/en/posts/custom-software-development-uk-the-complete-buyers-guide/" rel="noopener noreferrer"&gt;Custom Software Development UK - The Complete Buyer's Guide&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/outsourcing-software-development-to-a-uk-company-what-to-know/" rel="noopener noreferrer"&gt;UK Software Development Outsourcing - What to Know&lt;/a&gt;, &lt;a href="https://mecanik.dev/en/posts/crm-erp-integration-costs-methods-pitfalls/" rel="noopener noreferrer"&gt;CRM and ERP Integration: Costs, Methods and Pitfalls&lt;/a&gt; and &lt;a href="https://mecanik.dev/en/posts/mainframe-modernisation-rewrite-refactor-replatform/" rel="noopener noreferrer"&gt;Mainframe Modernisation: Rewrite, Refactor or Replatform&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How much does custom API development cost?&lt;/strong&gt;&lt;br&gt;
An internal API typically costs £10,000 to £30,000, a partner API £40,000 to £100,000, and a public product API upwards of £100,000. The audience drives the price far more than the number of endpoints, because external consumers require documentation, sandboxes, versioning and support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does it take to build a custom API?&lt;/strong&gt;&lt;br&gt;
An internal service usually takes four to eight weeks. A partner-grade API generally takes three to five months including documentation and a sandbox environment. Public APIs with self-service onboarding and usage metering commonly take six months or more before launch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What makes API development more expensive than expected?&lt;/strong&gt;&lt;br&gt;
Documentation, sandbox environments, per-consumer rate limiting, versioning support and observability. These rarely appear in early estimates and together often account for half the total effort on a partner or public API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should I build a REST or GraphQL API?&lt;/strong&gt;&lt;br&gt;
REST remains the safer default for partner and public APIs because tooling, caching and developer familiarity are broader. GraphQL suits internal use and rich client applications where consumers need flexible queries, though it shifts cost into query complexity limits and authorisation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What ongoing costs should I expect after launching an API?&lt;/strong&gt;&lt;br&gt;
Budget fifteen to twenty-five per cent of the build cost each year. That covers maintaining parallel versions during deprecation periods, engineering time spent answering integration questions, documentation upkeep and the monitoring required to support external consumers.&lt;/p&gt;

</description>
      <category>api</category>
      <category>programming</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
