10 Easy Python Programs
Practice basic Python with simple and clear examples
1. Hello World
Python Code:
print("Hello, World!")
Output:
Output will appear here...
2. Add Two Numbers
Python Code:
num1 = 5
num2 = 3
sum = num1 + num2
print("Sum is:", sum)
Output:
Output will appear here...
3. Swap Two Numbers
Python Code:
a = 4
b = 7
a, b = b, a
print("a:", a)
print("b:", b)
Output:
Output will appear here...
4. Check Even or Odd
Python Code:
num = 6
if num % 2 == 0:
print("Even")
else:
print("Odd")
Output:
Output will appear here...
5. Find Largest Number
Python Code:
a = 10
b = 20
if a > b:
print("a is largest")
else:
print("b is largest")
Output:
Output will appear here...
Comments
Post a Comment