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

Python Basics: Data Types & Functions

The document provides an overview of basic Python programming concepts, including data types, input functions, and simple projects like calculating the area of a rectangle and managing a shopping cart. It also covers mathematical functions using the math module, such as calculating the circumference and area of a circle, and the hypotenuse of a triangle. Additionally, it includes examples of conditional statements to demonstrate control flow in programming.

Uploaded by

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

Python Basics: Data Types & Functions

The document provides an overview of basic Python programming concepts, including data types, input functions, and simple projects like calculating the area of a rectangle and managing a shopping cart. It also covers mathematical functions using the math module, such as calculating the circumference and area of a circle, and the hypotenuse of a triangle. Additionally, it includes examples of conditional statements to demonstrate control flow in programming.

Uploaded by

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

# THIS ALL ARE PYTHON BASIC'S

#datatyps and uses

#name = "shaik" #str = string

#age =22 #int = intiger

#gpa = 2.9 #float = floatiing point

#if_student = True #bool = booluion value

#name = bool(name)

#print(name) #TYPECASTING .

#INPUT FUNTION .

#name = input("please enter your name : ") #input() = prompt the


usar to enter values

#age = int(input("how old are you :")) # in STRING variable

#age = age + 1

#print(f"Welcome {name}")

#print(f"you are {age} year old")

# PROJECT 1

# CALCULATE AREA OF A RECTANGLE

#length = float(input("Enter the length : "))

#wedth = float(input("Enter the wedth : "))

#area = length*wedth

#print(f"the area is {area}")


# PROJECT 2

# SHOPING CSRT

#item = input("What is the item :")

#prize = int(input("What is the prize :"))

#quantity = int(input("What is the quantity :"))

#total = prize*quantity

#print(f"You have bought {quantity} X {item}")

#print(f"your total ia : {total}")

#x = -4

#y = 6.7

#z = 9.5

#result = round(y) # round links to closest integer value

#result = abs(x) # ads calculate how far is a value from zero

#result = pow(y,3) # pow add power to variable (power = number


enter right to the comma)

#result = max(x,y,z) # max value from any number of variables

#result = min(x,y,z) # min value from any number of variables

#print(result)

# import math #importing is vert important in maths functions

# THIS ALL FUNCTION ARE FROM IMPORT MATH

#print([Link]) # value of pi

#z = 9.5

#result = [Link](z) # sqrt = squreroot of a variable


#result = [Link](z) # ceil = call element higher

#result = [Link](z) # floor = call element lower

#print(result)

# calculating circumferance of a corcle

#import math

#radius = float(input("Enter the radius : "))

#circumferance = 2*[Link]*radius

#print(f"Your circumferance is {round(circumferance,2)} ")

# calculate area of a circle

#import math

#radius = float(input("Enter the radius : "))

#area = [Link]*pow(radius,2)

#print (f"Area a of circle is {round(area,2)}")

# calculating Hypotinus of a triangle

#import math

#a = float(input("Enter the a adj : "))

#b = float(input("Enter the b opp : "))

#c = [Link](pow(a,2)+pow(b,2))

#print(f"Hypotinus of a triangle is {round(c)}")

# if and else statments


#age = int(input("Enter your age : "))

#if age >=100:

# print ("you are too old to sign up")

#elif age >= 18:

# print("You are elegibal for voting")

#elif age < 0:

# print("You are not born yet")

#else:

# print("you are NOT elegibal for voting")

#if_online = False

#if if_online:

# print("You are online")

#else:

# print("You are offline")

You might also like