zBasic Python Prog.
- Class-1 UNIT_II
1. >>> 2+3
5
2. print(4+3)
print(4-3)
print(4>3)
print("hello World")
>>> %Run [Link]
7
1
True
hello World
3. num=10
num+=1
print(num)
11
4.
5. print('Welcome to Python!')
print(“Welcome to Python”)
print(“ Hai this is nirmalalochan@[Link]”)
print(“”)
print(“ “)
6. print(‘hello \n pandey’)
print('good morning \n students')
good morning
students
good morning
students
You are most intelligent
7. print(0b1,0b10000,0b11111111)
print(0o1, 0o20, 0o377)
print(0x01, 0x10, 0xFF)
1 16 255
1 16 255
1 16 255
8. x = (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
>>> x
5192296858534827628530496329220095
X = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF
>>> oct(x)
'0o17777777777777777777777777777777777777'
>>> bin(x)
'0b111111111111111111111111111111111111111
11111111111111111111111111111111111111111
11111111111111111111111111111111'
>>>
y=0o1777777777777777777777777777777777777
7
>>> hex(x)
'0xffffffffffffffffffffffffffff'
9. Number with fractional part
3.1415 * 2
6.283
10. a condition that occurs when a calculated result is
too small in magnitude to be represented,
>>>1.0e-300 / 1.0e100
>>>0.0
11.
>>> 1.0e-300 -1.0e100
-1e+100
12. . string = "program"
for line in range(2):
print(string)
program
program
13. Complex program
A = 1+2j;
B=3+2j
>>> c=A+B
>>> print(c)
(4+4j)
>>>
print([Link])
print([Link])
print([Link]+3)
1.0
2.0
5.0
Input output statement
Basic_pay = input('Enter the Basic Pay: ')
Enter the Basic Pay: 70000
output statement
14. print('Hello world!')
print('Net Salary')
Hello world!
Net Salary
15.
16.
17. a,b,c,d = range(1,5)
>>> a
1
>>> b
2
>>> c
3
>>> d
4