Online Python Runner
ඔබේ Python කේතය සෘජුවම බ්රවුසරය තුළ ක්රියාත්මක කර ප්රතිඵල බලන්න
Python Code
Output
Ready
Output will appear here when you run your code...
💡 Tips:
• Use print() to display output
• Try different Python concepts
• Experiment with variables, loops, and functions
• Have fun coding!
💡 Tips:
• Use print() to display output
• Try different Python concepts
• Experiment with variables, loops, and functions
• Have fun coding!
උදාහරණ කේත
Hello World
ප්රථම Python program එක
print("Hello, World!")
print("Welcome to KDJ PYTHON!")
Variables
Variables සහ data types
name = "John"
age = 25
height = 5.8
is_student = True
print(f"Name: {name}")
print(f"Age: {age}")
print(f"Height: {height}")
print(f"Student: {is_student}")
For Loop
Loop භාවිතා කරමින් කේතය
numbers = [1, 2, 3, 4, 5]
for num in numbers:
square = num * num
print(f"{num} squared is {square}")
# Range function
for i in range(1, 6):
print(f"Count: {i}")
Functions
Function නිර්මාණය සහ භාවිතය
def greet(name):
return f"Hello, {name}!"
def calculate_area(length, width):
return length * width
print(greet("KDJ Python"))
area = calculate_area(10, 5)
print(f"Area: {area} square units")
If Statements
Conditional logic
score = 85
if score >= 90:
grade = "A"
elif score >= 80:
grade = "B"
elif score >= 70:
grade = "C"
else:
grade = "F"
print(f"Score: {score}")
print(f"Grade: {grade}")
List Operations
List manipulation
fruits = ["apple", "banana", "orange"]
# Add items
fruits.append("grape")
fruits.insert(1, "mango")
print("Fruits:")
for i, fruit in enumerate(fruits):
print(f"{i+1}. {fruit}")
# List comprehension
lengths = [len(fruit) for fruit in fruits]
print(f"Lengths: {lengths}")
Code Runner භාවිතා කරන්නේ කෙසේද?
1
කේතය ලියන්න
වම් පස editor එකේ ඔබේ Python කේතය ලියන්න
2
Run කරන්න
"Run Code" බොත්තම click කරන්න
3
ප්රතිඵල බලන්න
දකුණු පස output panel එකේ ප්රතිඵල බලන්න
4
අත්හදා බලන්න
විවිධ කේත අත්හදා බලමින් ඉගෙන ගන්න