0% found this document useful (0 votes)
30 views

Print (4+3) Print (4-3) Print (4 3) Print ("Hello World") %run First - Py 7 1 True Hello World Num 10 Num+ 1 Print (Num) 11

This document provides examples of basic Python programming concepts including arithmetic operations, variables, strings, loops, complex numbers, input/output statements, and range functions. Key concepts demonstrated include printing values, performing calculations, accessing real and imaginary components of complex numbers, accepting user input, and assigning values from a range to multiple variables.

Uploaded by

chlor z
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Print (4+3) Print (4-3) Print (4 3) Print ("Hello World") %run First - Py 7 1 True Hello World Num 10 Num+ 1 Print (Num) 11

This document provides examples of basic Python programming concepts including arithmetic operations, variables, strings, loops, complex numbers, input/output statements, and range functions. Key concepts demonstrated include printing values, performing calculations, accessing real and imaginary components of complex numbers, accepting user input, and assigning values from a range to multiple variables.

Uploaded by

chlor z
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

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 first.py


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 [email protected]”)
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(A.real)
print(A.imag)
print(A.imag+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

You might also like