1.
Features of Python
Code:
# Program to display Python features
print("Python is Easy to Learn, Interpreted, and Dynamically Typed.")
Sample Output:
Python is Easy to Learn, Interpreted, and Dynamically Typed.
2. Execution of a Python Program
Code:
# Save this file as [Link] and run it from the terminal
print("Hello, Python!")
Sample Output:
Hello, Python!
3. Single, Double, and Triple Quoted Strings
Code:
single_quoted = 'Hello'
double_quoted = "World"
triple_quoted = """This is a multi-line
string example."""
print(single_quoted)
print(double_quoted)
print(triple_quoted)
Sample Output:
Hello
World
This is a multi-line
string example.
4. String Concatenation, Repetition, and Slicing
Code:
str1 = "Hello"
str2 = "Python"
concat = str1 + " " + str2
repeat = str1 * 3
slice_str = str2[0:3]
print(concat)
print(repeat)
print(slice_str)
Sample Output:
Hello Python
HelloHelloHello
Pyt
5. Even or Odd Number Check
Code:
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")
Sample Output:
Enter a number: 4
Even