Python basic example for beginners
- Get link
- X
- Other Apps
What is python
Python is a high level easy to learn programming language use for web development, mechine learning,deep learning, artificial intelligence and much more.
Write your first program
a=5
b=9
print(a+b)
Hear a and b is valuable
Ex 2
Print ("Hello rashmika")
Output Hello rashmika
This language usually easy for every language.
You properly know the syntax only
Variable: Variable is nothing but only contain information
Conditional and loop in python:
Almost every programming you can used conditional and loop statement
Ex. Create a multiplication tables:
# Using while loop
# To take input from the user
num = int(input("Display multiplication table of? "))
count = 1
while count < 11:
print(num, ' x ', count, ' = ', num * count)
count = count + 1
Area of a triangle:
# sides of a triangle
a = 3
b = 4
c = 5
# calculate the semi-perimeter
s = (a + b + c) / 2
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is', area)
- Get link
- X
- Other Apps
Comments
Post a Comment