Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
menu_book Course Curriculum (Intro to Programming) expand_more
Intro to Programming / Practical Programs

Command-line arguments

Learn Command-line arguments in Intro to Programming with a focused explanation, a topic-specific example, and a mastery check.

12 min read • Intermediate
intro-programming-027.py
python
import sys
name=sys.argv[1] if len(sys.argv)>1 else 'guest'
print('hello',name)
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content