Python Lesson for the beginners to understand the basic concept of python.pptx
DurgaPrasad774801
32 views
26 slides
Jun 28, 2024
Slide 1 of 26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
About This Presentation
This note will help the learners to get some concept of python.
Size: 9.1 MB
Language: en
Added: Jun 28, 2024
Slides: 26 pages
Slide Content
Programming is the process of creating a set of instructions that tell a computer how to perform a task. P rogramming can be done by using some computer programming languages, such as Python, Java, C, C++, PHP etc. What do you mean by programming?
What is Python? Who created it? Python is a high-level, interpreted, and general-purpose programming language. ❖ Python was developed by Guido Van Rossam and made available to the public in 1991. ❖ The name Python was selected from the TV Show "The Monty Python's Circus", and from the logo which looks like Python.
❖ Free and Open-Source: Completely free to use, even for commercial purposes. ❖ Python can run on different operating systems such as Windows, macOS, and Linux ❖ Python is easy to learn , any body without programming knowledge can learn Python. Python has a simple syntax similar to the English language. Features of Python
Where and who uses Python? The Python Application are: Web Development Game Development Scientific and Numeric Applications Artificial Intelligence and Machine Learning Software Development Business Applications Education programs Python is recognized as an official language at Google.
Why Python Language ranking in Google JavaScript : JavaScript for web development. It's used for both front-end and back-end development. 2. Python: It is used in web development, data analysis and more in machine learning
Why select Python Programming? #include< stdio.h > int main() { printf (“Hello World”); return 0; } C print(“Hello World”) Python public class Main{ public static void main(String[] args ) { System.out.println (“Hello World”); }} Java #include< iostream > using namespace std ; int main() { cout <<“Hello World”; return 0;} C++ Therefore, Python is e asy to learn . To display “Hello World” using different programming language, we use coding like….
Python Environment Official Website - www.python.org Python Version – The Latest is 3.12 How to install Python in our System The use of Python IDLE
How to Download & Install Python in our system? Python is a free Software Step-1: Check your Windows Operating System (64 bit/32 bits) Step-2: Open your Browser and type www.python.org/downloads/ https://www.youtube.com/watch?v=UvcQlPZ8ecA How to install Python Link
IDLE - Integrated Development and Learning Environment Python Text Editor ❖ Some of the text editors to write the Python code are:
To check and open python idle in our computer IDLE
The two types of IDLE Window Editor Window Shell Window
Editor Window Shell Window You can write code, modify code . Mainly used to see how the program works .
Mobile apps for Python
Practical Lesson on Python
print() print(“ Hello World ”) Practice: print out your own name. Will this program correct: Print(“ Hello World ”)
How to open and run a program 1. Selected /Open the folder where the Python Program is saved. 2. Right-click a fter selecting " Edit with IDLE ” 3. Running the program Press F5
What is the input? The Input is nothing but some value from a system or user . For example, if you want to perform an addition of two numbers on the calculator you need to provide two number to the calculator, those two number is nothing but an input provided by the user to a calculator program. Input function
input() Example Ask for the user's name and print it: name = input('Enter your name:') print('Hello, ‘ + name) Output In Python, the input() function is used to take user and then returns a string that contains the input.
Task 2. Accepting input from the user name = input (" Enter Student Name ") age = input (" Enter Age ") School = input (" Enter School name ") print("\n") print(name, age, school) Output
Write a simple Python program that takes two numbers as input from the user, adds them together, and prints the result: num1 = int(input("Enter the first number: ")) num2 = int(input("Enter the second number: ")) result = num1 + num2 print("The sum of", num1, "and", num2, "is", result) Accepting integer input from the user
Accepting integer input from the user # program to calculate addition of two input numbers first_number = int( input (" Enter first number ")) second_number = int( input (" Enter second number ")) print("\n") print(" First Number :", first_number) print(" Second Number :", second_number) sum1 = first_number + second_number print(" Addition of two number is : ", sum1)
Follow up Activities Create a real program
# Take input from user principal = float(input("Enter the principal amount: ")) rate = float(input("Enter the annual interest rate (%): ")) time = float(input("Enter the time period (in years): ")) # Calculate the simple interest interest = (principal * rate * time) / 100 # Display the result print("The simple interest for a principal amount of", principal, "at an annual interest rate of", rate, "for a time period of", time, "years is", interest) Write a Python program that calculates the simple interest based on the principal amount, interest rate, and time period, which are taken as input from the user:
Comments In Python, comments are used to add notes or explanations to your code that are not executed by the interpreter. Comments start with the hash symbol # and continue until the end of the line.
Single line comments Tips: You don't have to annotate each piece of code. You can annotate a block of code with a certain function #It's a question-and-answer procedure for asking names. #print("Hello World") #print("My name **. ") print("What is your name? ”) name = input("Please enter your name: ") print("My name is: ", name) We can annotate multiple lines with three pairs of single quotes or double quotes. Such as: ‘‘‘This is a multiline annotation’’’ """This is a multiline docstring."""