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

Python Class 8

Python is a popular programming language that can be used for web development, data analysis, and artificial intelligence. It executes code line by line, either using the Python interpreter or by writing code in a text editor. The print function displays output, variables store data of different types like integers and strings, and arithmetic operators perform calculations. Conditional statements and loops allow decisions and repetition in code using indentation.

Uploaded by

ipscr.mansi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views

Python Class 8

Python is a popular programming language that can be used for web development, data analysis, and artificial intelligence. It executes code line by line, either using the Python interpreter or by writing code in a text editor. The print function displays output, variables store data of different types like integers and strings, and arithmetic operators perform calculations. Conditional statements and loops allow decisions and repetition in code using indentation.

Uploaded by

ipscr.mansi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Python Introduction:

• Python is a popular and easy-to-learn programming language.


• It is widely used for web development, data analysis, artificial intelligence, and more.
• Python code is executed line by line.
• You can use the Python interpreter (IDLE) or write code in a text editor and run it.

Printing to the Console:

Use the print() function to display text or variables on the screen.

print("Hello, World!")

Variables and Data Types:

Variables are used to store data.

Common data types include integers, floats, strings, and booleans.

x=5 # integer

y = 3.14 # float

name = "Alice" # string

Arithmetic Operators:

Python supports arithmetic operations like addition, subtraction, multiplication, and division.

a = 10

b=5

sum = a + b

difference = a - b

product = a * b

quotient = a / b

modulus = a%b

power = a**b

Conditional Statements:

Use if, elif, and else to make decisions in your code.

age = 12

if age < 12:

print("You are a child.")


elif age >= 12 and age < 18:

print("You are a teenager.")

else:

print("You are an adult.")

Loops:

for and while loops help you repeat actions.

for i in range(5):

print(i)

while x < 10:

print(x)

x += 1

Indentation:

Python uses indentation to define code blocks, like loops and in conditional statements,
1- WAP AREA OF RECTANGLE
CODE OUTPUT

2- WAP AREA OF CIRCLE


CODE OUTPUT

3- WAP AREA OF CUBOID


CODE OUTPUT

BY- KESHWAM BAJPAI


4- WAP AREA OF CUBE
CODE OUTPUT

5- WAP AREA OF CSA OF CYLINDER


CODE OUTPUT

6- WAP AREA OF TSA OF CYLINDER


CODE OUTPUT
7- WAP AREA OF CSA OF CONE
CODE OUTPUT

8- WAP AREA OF TSA OF RIGHT CIRCULAR CONE


CODE OUTPUT

9- WAP TSA OF SPHERE


CODE OUTPUT
10- WAP VOLUME OF CUBOID
CODE OUTPUT

11- WAP VOLUME OF CUBE


CODE OUTPUT

12- WAP VOLUME OF CYLINDER


CODE OUTPUT
13- WAP VOLUME OF CONE
CODE OUTPUT

14- WAP VOLUME OF SPHERE


CODE OUTPUT

15- WAP PERIMETER OF RECTANGLE


CODE OUTPUT
16- WAP AREA OF SQUARE
CODE OUTPUT

17- WAP AREA OF TRIANGLE


CODE OUTPUT
18- WAP GREATEST NO. IN THREE NO.
CODE OUTPUT

19- WAP PERIMETER OF TRIANGLE


CODE OUTPUT
20- WAP GREATEST NO. IN FOUR NO.
CODE OUTPUT
21- WAP TO CHECK DIVISION IN RESULT
CODE OUTPUT
22- WAP TO CHEAK AGE CRITERIA

CODE OUTPUT
23- WAP SUM OF NTH NO.

CODE OUTPUT

24- WAP TO CHEAK THE VALUE OF FACTORIAL


OUTPUT CODE

You might also like