SShortSingh.
Back to feed

Python Functions Explained: Parameters, Return Values, and Scope Basics

0
·53 views

Python functions are reusable named blocks of code defined with the 'def' keyword and executed only when explicitly called. They can accept inputs through parameters, which may have default values or be passed by name using keyword arguments. When the number of inputs is unknown, '*args' and '**kwargs' allow functions to handle variable positional and keyword arguments respectively. The 'return' statement sends a computed value back to the caller for further use, unlike 'print()', which only displays output to the console without storing it. Understanding these core concepts — definition, parameters, return values, and variable scope — is fundamental to writing effective Python programs.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Experienced Teams Gain From AI Coding Tools While Unsupervised Use Breaks Apps

A team behind the Walletverse crypto wallet argues that AI coding tools help experienced engineers but can quietly destabilize applications built without rigorous oversight. They cite Google's claim that AI generates more than a quarter of its new code, which engineers then review before acceptance. Google's DORA research found AI amplifies existing team strengths and weaknesses, with weak testing and version control leading to instability. Security researchers have repeatedly found flaws such as missing access rules and exposed keys in publicly shared vibe-coded apps. The piece contrasts this with 'vibe engineering,' the practice of experienced developers using AI while remaining accountable for shipped code.

0
ProgrammingDEV Community ·

Retail, OEM and Volume Windows Licenses: How They Differ and Why It Matters

Windows licenses come in three main types, and each behaves differently when it comes to activation and transferring between machines. Retail licenses are bought separately from any computer, can be moved to a new PC, but may only be active on one device at a time. OEM licenses are preinstalled by manufacturers and stored in the motherboard firmware, so they activate automatically but are generally tied to that hardware and do not transfer when it is replaced. Volume licenses, used by organisations through KMS or MAK activation, are not intended for home PCs, and secondhand business laptops carrying them often show activation errors or expiry warnings. Users can identify their license channel by running the slmgr /dli command in an administrator terminal and checking the Description line before attempting any activation fix.

0
ProgrammingDEV Community ·

Krisp Voice Isolation Targets Background Speech That Confuses Voice AI Agents

Voice agents often misbehave not because of the language model or voice output but because speech-to-text picks up a second person talking nearby. Standard STT is built to capture all speech, so it cannot tell which words belong to the caller and which come from a bystander. This leads to wrong transcripts, false interruptions, and broken turn-taking. Krisp's Voice Isolation API and SDK sits at the front of the pipeline and passes through only the main speaker's voice. In the reviewer's test, background speech that had produced 331 words of spurious transcript dropped to zero, though the tool adds a small cost on clean phone audio and is limited to a US-only API region.

0
ProgrammingDEV Community ·

Unreported values should not be recorded as zero in clinical evidence tables

A DEV Community article argues that a recorded zero, an unreported value, and an unchecked entry are distinct and should stay separate when pulling numbers from clinical papers. It presents a small Python example using synthetic teaching records to show how each status is validated and displayed. The author stresses that a reported zero must keep its source locator, while an "unreported" status only means no value was found in the material reviewed, not that an event did not occur. The piece recommends keeping the paper identifier, locator, access level, and review status with each extracted value to support handoffs. The example is explicitly illustrative and does not describe findings from real trials.