Run Python Without main
Lesson 1 of 48 in Coddy's Python for C Developers course.
Bring your C experience with variables, loops, functions, structs, and pointers. Python manages objects and executes statements without a C main function or a compilation step in this editor. Start by running the supplied print call. Every task uses multiple files: open main.py for this first run; the locked driver.py is the entry file and loads the learner code. Later lessons explain imports and put one class in each module. No prior Python course is required.
Challenge
BeginnerRun the ready-made Python code once; no editing or input is required. The single output line is Python is ready.
C starts at main; this Python program runs statements in its entry file.
Your code goes in main.py. The locked driver.py is the entry file, supplies execution and checks, and cannot be edited.
Try it yourself
# Starts the program in main.py. Edit main.py to solve the challenge.
from runpy import run_module
run_module("main", run_name="__main__")
All lessons in Python for C Developers
1From C Programs to Python
Run Python Without mainPrinting Without Format CodesNames Versus Typed StorageDivision and Integer LimitsSuites Instead of BracesRecap: A Python Receipt4Iteration and Transformations
Iteration Without PointersIndexes Without Pointer MathSentinels and Loop ControlComprehensions and SortingRecap: Stable Ranking2Values and Truth Tests
Absence Is Not a Null PointerContent Versus Object IdentityTruth Tests and OperandsConditional Value SelectionRecap: Missing or Eligible3Containers and Aliasing
Lists Versus C ArraysTuples and Struct ValuesMappings and Lookup LoopsPointers, Copies, and AliasesRecap: Inventory Collections6Contracts, Errors, and Modules
Text Input and Exact OutputError Codes Versus ExceptionsImports Are Not IncludesAnnotations Versus C TypesRecap: Validate a Batch9Project: An Order Processor
Project: Model an OrderProject: Pricing PoliciesPractice on your own: Online Python compiler