DL Lab1
DL Lab1
In [1]: #Aim : Study basic operations in Python programming and NumPy library.
In [2]: # Data_Types_and_Basics.ipynb
import numpy as np
import pandas as pd
# Numbers
print("## Numbers")
numl = 10 # Integer
# Boolean
# Strings
# Lists
print("### List")
# Dictionaries
print("### Dictionary")
# Tuples
# Sets
# If-Else
print ("## If-Else")
x = 10
if x>5:
print("x is greater than 5")
else:
print("x is 5 or less")
# For Loop
# While Loop
# Section 5: Functions
print("### 5. Functions")
def add_numbers(a, b):
return a +b
print("Function Example - Sum:", add_numbers(5, 10))
# Section 7: NumPy
print("# 7. NumPy")
# Random
random_numbers = np.random.rand(5)
print("Random Numbers:", random_numbers)
# Array Methods
# 1D and 2D Arrays