SShortSingh.
Back to feed

Python Day 7: Positional-only and keyword-only arguments, plus return statements

0
·15 views

This Python tutorial covers the Day 7 lesson on function parameter syntax and returning values. The slash (/) marks parameters that must be passed by position, so passing them by name raises a TypeError. The asterisk (*) marks parameters that must be passed by keyword, which is shown with examples of valid and invalid calls. A summary table and reminder explain that parameters before / are positional-only and those after * are keyword-only. The lesson also explains that the return statement sends a value from a function back to its caller, illustrated with a function that returns a trophy name based on comparing two scores.

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 ·

mitmAny Lets AI Assistants Analyze Captured HTTP Traffic Through MCP

mitmAny is a free, MIT-licensed open-source HTTP and HTTPS inspector for macOS and Windows, with an Android USB capture workflow. Its maintainer describes a setup that connects captured traffic to an MCP-compatible AI client, which can then summarize flows and analyze evidence. Users are advised to inspect only applications they own or are authorized to test, trust the local CA certificate for HTTPS, and narrow the analysis to a specific API host. The tool is read-only for network traffic, but it has limits, including no QUIC/HTTP3 or WebSocket message inspection and possible incomplete bodies. The article also warns that data sent to a connected AI client may be shared with its model provider, and that automated redaction may not remove all secrets.

0
ProgrammingDEV Community ·

Supreme Court declines to merge multi-state cyber-fraud FIRs against Gujarat-Haryana accused

The Supreme Court on 20 November 2026 refused to consolidate criminal cases registered in Gujarat and Haryana against a woman accused in a cloud-space investment fraud. The bench held that an accused cannot dictate where victims file complaints or stop police in different states from investigating. The cases remain pending before trial courts in Gandhinagar and Faridabad. The petitioner was permitted to ask the relevant High Courts to consolidate cases within a single state. This is the third such refusal by the court since July 2026.

0
ProgrammingDEV Community ·

Monitoring MCP agents with OpenTelemetry: tracing tool calls, attributes, latency and errors

AI assistants that call tools in production can slow down or pick wrong tools without triggering classic alerts, so monitoring is needed. An MCP tool call behaves like a distributed operation, letting teams apply familiar distributed tracing if they choose consistent span names and attributes. OpenTelemetry offers a vendor-neutral format, shared GenAI semantic conventions, and context propagation that links agents, MCP servers and downstream services in one trace. Spans are named after the MCP method and tool, and carry attributes such as the method name, tool name, session ID and error type, while arguments and results are optional because they may contain sensitive data. Because HTTP headers are insufficient, trace context is injected into the params._meta field of each MCP request, and the official Python SDK version 2 already emits server spans, requiring only an SDK and an OTLP exporter to collect them.

0
ProgrammingDEV Community ·

Wall Jump Tower: How Physics Tuning Shapes a One-Button Climber

A small browser game called Wall Jump Tower uses only a single button, so the developers rely heavily on physics tuning to make jumps feel right. The climber rises under lighter gravity and falls faster, while a brief hang near the peak of a held jump gives players time to read the next wall. Fall speed is capped, wall contact sticks briefly before sliding, and small corner clips and ledge edges are forgiving rather than fatal. The timing is measured in milliseconds so that jumps behave the same on 60 Hz and 120 Hz displays, and the game includes 15 short levels with ghost replays of best runs.