You are on page 1of 1

ANS-1. we define funition in python by using DEF keyword.

then name of function is


written and then paranthes is used().fumctiom can be called by passing keyword
agruments in it.we can also use postional gruments for this
eg.
def multiply(a,b):
c=a*b
return c
-for postional agrument while calling
multiply(6,7)
-for keyword
multiply(a=6,b=9)

ANS-2.to create dictionary we use{}


eg.
mydict{
.....
.....
}
-to acess it we use
print(mydict[...])
to create list we use[]
eg.
mylist=[.....]
to acess list
print(mylist[indexno.]
to create sets we use set function
eg.
x=set([.....])
print(x)

ANS-3.for loop is used to check all item in data


eg
fruits=['apple','banana']
for x in fruits:
print(x)

ANS-4.if else is use to contiue one statement if one condtion is true otherwise
another
eg.
num=3
if num>o:
print('num is postive)
else
print(num is negative)

ANS-5 % is used to format set of variables


eg.
name='ram'
print('hello,%s!' % name)

ANS-6 it is used when statement is not needed but wanted any ommand to run the code