Welcome to Natural Python! This guide will help you write Python code using natural language.
Try these examples to get started.
Creating Variables
# Numbers
Make a number called score equal to 10
Let age be 25
# Strings
Create a string called name equal to "Alice"
Set message to "Hello, World!"
# Lists
Make a list called fruits equal to ["apple", "banana"]
Create numbers with [1, 2, 3, 4, 5]
Math Operations
# Basic Math
Add 5 to score
Subtract 3 from age
Multiply score by 2
Divide total by 4
# Natural Language Math
Make score bigger by 10
Increase age by 1
Double the number
Half the value
Conditionals
# If Statements
If score is bigger than 10:
Print "High score!"
If age is less than 18:
Print "Too young"
else:
Print "Welcome!"
# Natural Conditions
When the number equals 100:
Print "Perfect score!"
Check if name is "Alice":
Print "Hello Alice!"
Loops and Lists
# List Operations
Add "orange" to fruits
Remove "banana" from the list
Insert "mango" at position 0
# Loops
For each fruit in fruits:
Print fruit
While score is less than 100:
Add 10 to score
Print score