Python Examples
Simple, readable, and versatile - perfect for everything from web apps to data science.
Example 1: Adding two Numbers
Code
# Taking input from user
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
# Calculating sum
sum = a + b
# Displaying output
print("Sum is:", sum)
Input
Enter first number: 10 Enter second number: 8
Output
Sum is: 18
Code Explanation
prompt() takes input as string; we use Number() to convert to number. a + b adds the two numbers. print() displays the result.