Professional Documents
Culture Documents
>>> 4-2
>>> "Hello"+"world"
'Helloworld'
Interactive mode :
print("Save Earth")
print("Preserve future")
Result
Save Earth
Preserve future
>>>
num1 = 10
num2 = 20
print(result)
Result
30
length = 10
breadth = 20
area = length*breadth
print(area)
Result
200
Practical -5
>>> quantity = 10
>>> type(quantity)
<class 'int'>
>>> type(Price)
<class 'float'>
>>> list1
>>> print(tuple1)
#create a dictionary
>>> print(dict1['Price(kg)'])
120
Practical -7
'HelloIndia'
# x+ = y is same as x = x + y
>>> num1 = 10
>>> num2 = 2
>>> num1 += num2
>>> num1 12
>>> num2
# x − = y is same as x = x – y
>>> num1 = 10
>>> num2 = 2
>>> num1
>>> num1 = 10
True
False
>>> num1 = 10
>>> num2 = 2
False
>>> num1 = 10
True
False
>>> 2 in numSeq
True
False
True
False
Input and Output
Condition
print("Eligible to vote")
else:
else:
Output:
Practical -14
if num>0:
print("Number is positive")
print("Number is negetive")
else :
numbers = [1,2,3,4,5,6,7,8,9,10]
if (num % 2) == 0:
Output:
2 is an even Number
4 is an even Number
6 is an even Number
8 is an even Number
10 is an even Number
Practical -16
numbers = [1,2,3,4,5,6,7,8,9,10]
print(num * 10)
Output:
10
20
30
40
print(var2 + 1)
Output:
Iteration 1 of outer loop