0% found this document useful (0 votes)
3 views4 pages

Python Basics: Simple Programs Guide

The document contains a series of simple programming examples primarily in Python, demonstrating basic concepts such as printing messages, user input, arithmetic operations, and data types. It includes programs for printing 'Hello World', adding numbers, calculating the square of a number, finding the area of a circle, and displaying student details and marks. Each example illustrates fundamental programming techniques suitable for beginners.

Uploaded by

ayanx0099
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Python Basics: Simple Programs Guide

The document contains a series of simple programming examples primarily in Python, demonstrating basic concepts such as printing messages, user input, arithmetic operations, and data types. It includes programs for printing 'Hello World', adding numbers, calculating the square of a number, finding the area of a circle, and displaying student details and marks. Each example illustrates fundamental programming techniques suitable for beginners.

Uploaded by

ayanx0099
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

[Link] world!

Program

Print(“Hello world!”)

[Link] your all details like..(name,age,address,12th Percentage ,cource)

3. Add Two Numbers

a = 10

b = 20

sum = a + b

print("Sum =", sum)

4. Input from User and Add

a = int(input("Enter first number: "))

b = int(input("Enter second number: "))

sum = a+b

print(sum)

5. Find Square of a Number

num = int(input("Enter a number: "))

Square = num * num

print(Square)
6. Find Area of Circle

r = float(input("Enter radius: "))

area = 3.14 * r * r

print("Area of Circle =", area)

7. Program: Print Student Details

8. Mix All Data Types Together

# Mix of different data types

name = "Dipak"

age = 19

percentage = 88.7

is_pass = True

print("--- Student Details ---")

print("Name:", name)

print("Age:", age)

print("Percentage:", percentage)
print("Pass:", is_pass)

9. Type Checking Program

10. Student Marks Calculation

# Student marks example using data types

# String type

student_name = "Riya"

# Integer type

subject1 = 85

subject2 = 78

subject3 = 92

# Float type

average = (subject1 + subject2 + subject3) / 3

# Boolean type

is_pass = average >= 40


# Print all details

print("--- Student Result ---")

print("Name:", student_name)

print("Subject 1 Marks:", subject1)

print("Subject 2 Marks:", subject2)

print("Subject 3 Marks:", subject3)

print("Average:", average)

print("Pass Status:", is_pass)

You might also like