Tuesday, June 14, 2022

phython math

phython math :

x = min(5, 10, 25)
y = max(5, 10, 25)
print(x)
print(y)

x = abs(-7.25)
print(x)

x = pow(4, 3)
print(x)

import math
x = math.sqrt(64)
print(x)
x = math.ceil(1.4)
y = math.floor(1.4)
print(x) 
print(y)
x = math.pi
print(x)
output:

Wednesday, June 8, 2022

class and objects

 class and object example: 

class Person:

 def __init__(self,name,age,city):

  self.name = name 

  self.age = age

  self.city = city

p1 = Person ("shraddha",19,"babra")

print (p1.name)

print(p1.age)

print(p1.city)




Tuesday, June 7, 2022

array

what is an array?

array is special variable ,which can hold more than one value at a time.

example:

car1 = " ford "

car2 = "bmw"

car3 ="volvo"

EXAMPLE:

modify the value of the first array item:

cars[0] = "toyota"