Working with Numbers & String in Python
Working with Numbers & String in Python
String in Python
Python Numbers
Python numbers are a fundamental data type
for representing and manipulating numerical
values.
x = 4 # int number
y = 0.8 # float number
z = 4j # complex number
# from int to float:
a = float(x)
print(a)
Python Strings
E.g:
name = “Priya"
role = "Software Engineer"
print(name)
print(role)
Working with Strings
E.g:
def fun():
print("Welcome to vcas")
Types of Functions in Python
# Program to illustrate
# the use of user-defined functions
def add_numbers(x,y):
sum = x + y
return sum
num1 = 5
num2 = 6
E.g:
def college():
print("Welcome to vcas")
# to call a function
college()
THANKYOU