This document provides an introduction and overview of key Python concepts including:
1. Operators and expressions, data types, variables, functions, program flow, input/output, and iteration are introduced.
2. Key Python constructs like if/else conditional statements, while loops, functions, and getting input from the user are demonstrated through examples.
3. Best practices for writing clear, well-structured Python code are discussed, including using parameters in functions, returning values, avoiding hard-coded values, and properly indenting code blocks.
What is Python? | Uses, features & flavours of Python | Running Python | Identifiers | key words | values & types | Type casting | Operators | Functions | Types of arguments
This document provides an introduction and overview of the Python programming language. It describes Python as a general-purpose, object-oriented programming language with features like high-level programming capabilities, an easily understandable syntax, portability, and being easy to learn. It then discusses Python's characteristics like being an interpreted language, supporting object-oriented programming, being interactive and easy to use, having straightforward syntax, being portable, extendable, and scalable. The document also outlines some common uses of Python like for creating web and desktop applications, and provides examples of using Python's interactive and script modes.
The document provides instructions for downloading and installing Python and PyCharm on Mac and Windows systems. It outlines the steps to download each program from their respective websites, then guides the user through installing Python and PyCharm on their device by navigating folders and clicking through installation windows. It also briefly introduces some basic programming concepts that will be covered in an upcoming Python tutorial, such as variables, data types, conditional statements, and loops.
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
Python
Language
is uesd in engineeringStory adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they s
This document provides an introduction and overview of the Python programming language course CSE 120 handled by G.Gandhi Jaba Kumar. It discusses that Python is an interpreted, object-oriented, and interactive programming language used for web development, software development, mathematics, and system scripting. The document then covers Python syntax including indentation, comments, keywords, variables, data types, operators, and basic programming concepts like conditionals and loops. It provides examples to illustrate Python code and best practices.
This document provides an introduction and overview of the Python programming language. It discusses Python's key features such as being an interpreted, object-oriented, high-level programming language with dynamic typing and a large standard library. It also covers Python's use as both a scripting and general purpose language. The document then discusses Python's data types, operators, control flow statements, functions, and lambda expressions. It provides examples of using Python interactively and in script mode.
This document provides an outline and overview of key Python concepts including operators, data types, variables, functions, and program flow. It introduces Python as an interpreted programming language with a strict syntax. Operators like +, -, *, / perform actions on operands to produce new values. Data types include integers, floats, booleans and strings. Variables are used to store and reference data. Functions allow for code reuse and abstraction by defining reusable blocks of code. Program flow can be controlled using conditional statements like if/else.
The document provides an overview of the Python programming language. It discusses why Python is useful for students and professionals, its major features like being object-oriented and having a large standard library. The document also covers Python's history, how to install it and set the environment variables, basic syntax like variables and data types, operators, and common programming constructs like conditionals and loops.
This document is a Python cheat sheet created by Mosh Hamedani to summarize the core concepts covered in his Python tutorial. It includes sections on variables, data types, operators, control flow, functions, classes, modules and the standard library. The author encourages readers to enroll in his Complete Python Programming Course if they want to become a Python expert.
This document provides an introduction to Python fundamentals, including its basic elements and syntax. It discusses the key components needed to write Python programs, such as variables, identifiers, keywords, datatypes, input/output, comments, constants, and operators. Variables are used to store data values, identifiers name variables, and keywords are reserved words that cannot be used as identifiers. There are built-in datatypes like integers, floats, Booleans and strings. The document also covers basic operators for manipulating data and performing comparisons.
This document outlines the objectives, outcomes, syllabus, and content of a Python Programming course. The objectives are to learn Python syntax, semantics, data types, containers, control flow, functions, object-oriented programming, and coding techniques. The outcomes are developing programming skills in Python concepts like data types, applying Python basics to solve coding tasks involving conditionals, loops, and object-oriented programming. The syllabus covers introduction to Python, control structures, strings/files, lists/dictionaries, functions, file operations, errors/exceptions, and graphical user interfaces.
Basic concept of Python.pptx includes design tool, identifier, variables.supriyasarkar38
This document discusses Python programming concepts including data types, variables, operators, and functions. It provides examples of Python syntax for writing and executing code as well as built-in data types like strings, integers, and lists. Key concepts covered include variables, data type casting, comments, arithmetic and comparison operators, and functions.
This document provides an outline and overview of key concepts in Python including operators and expressions, data types, variables, functions, program flow, user input, and iteration. It introduces Python syntax, built-in data types like integers, floats, booleans and strings. It describes operators, variables, functions, conditional statements like if/else, and repetition with loops. Examples are provided to demonstrate concepts like arithmetic expressions, type conversion, scope of variables, parameter passing in functions, and handling errors from user input.
Introduction To Programming with PythonSushant Mane
The document provides an introduction to the Python programming language. It discusses Python's core features like being an interpreted, object-oriented, and dynamic language. It covers basic Python concepts like data types, variables, operators, control flow, functions, modules, file handling, and object-oriented programming. The document contains examples and explanations of built-in types like numbers, strings, lists, tuples, and dictionaries. It also discusses control structures, functions, modules, and classes in Python.
The document discusses various parts of the Python programming language including keywords, variables, operators, data types, and more. It provides examples and explanations of concepts like:
- Keywords are reserved words with specific uses like False, None, True, and, or, etc.
- Variables store values in reserved memory locations and can be of different data types like integers, floats, strings.
- Python supports common operators for arithmetic, comparison, logical, bitwise and other operations.
- Core data types include numbers, strings, lists, tuples, and dictionaries.
- Other concepts covered are indentation, comments, input/output functions, type conversions.
This document provides an introduction to the Python programming language. It discusses what Python is, why it should be used, and some key features like variables, data types, operators, conditional statements, loops, lists, tuples, modules and more. Examples are provided to demonstrate how each concept works in Python code. Links to Colab notebooks with additional Python examples and exercises are included at the end.
The document provides an introduction to Python programming and application development. It discusses that Python is an interpreted, high-level and object-oriented programming language. It then covers key Python concepts like data types, variables, operators, expressions and statements. The document also lists some common Python applications like data science, web development, AI and more.
This document provides an overview of the Python programming language and concepts like variables, data types, operators, conditional execution, functions, and iteration. It discusses key features of Python like it being an interpreted language, the Python virtual machine, differences between Python 2 and 3. It also covers topics like installing Python, using text editors, values and variable types, operators, expressions, conditional execution using if/else statements, exception handling with try/except, functions and their parameters/arguments. The document includes examples and activities for readers to practice the concepts.
This document provides an outline and overview of key Python concepts including operators, data types, variables, functions, and program flow. It introduces Python as an interpreted programming language with a strict syntax. Operators like +, -, *, / perform actions on operands to produce new values. Data types include integers, floats, booleans and strings. Variables are used to store and reference data. Functions allow for code reuse and abstraction by defining reusable blocks of code. Program flow can be controlled using conditional statements like if/else.
The document provides an overview of the Python programming language. It discusses why Python is useful for students and professionals, its major features like being object-oriented and having a large standard library. The document also covers Python's history, how to install it and set the environment variables, basic syntax like variables and data types, operators, and common programming constructs like conditionals and loops.
This document is a Python cheat sheet created by Mosh Hamedani to summarize the core concepts covered in his Python tutorial. It includes sections on variables, data types, operators, control flow, functions, classes, modules and the standard library. The author encourages readers to enroll in his Complete Python Programming Course if they want to become a Python expert.
This document provides an introduction to Python fundamentals, including its basic elements and syntax. It discusses the key components needed to write Python programs, such as variables, identifiers, keywords, datatypes, input/output, comments, constants, and operators. Variables are used to store data values, identifiers name variables, and keywords are reserved words that cannot be used as identifiers. There are built-in datatypes like integers, floats, Booleans and strings. The document also covers basic operators for manipulating data and performing comparisons.
This document outlines the objectives, outcomes, syllabus, and content of a Python Programming course. The objectives are to learn Python syntax, semantics, data types, containers, control flow, functions, object-oriented programming, and coding techniques. The outcomes are developing programming skills in Python concepts like data types, applying Python basics to solve coding tasks involving conditionals, loops, and object-oriented programming. The syllabus covers introduction to Python, control structures, strings/files, lists/dictionaries, functions, file operations, errors/exceptions, and graphical user interfaces.
Basic concept of Python.pptx includes design tool, identifier, variables.supriyasarkar38
This document discusses Python programming concepts including data types, variables, operators, and functions. It provides examples of Python syntax for writing and executing code as well as built-in data types like strings, integers, and lists. Key concepts covered include variables, data type casting, comments, arithmetic and comparison operators, and functions.
This document provides an outline and overview of key concepts in Python including operators and expressions, data types, variables, functions, program flow, user input, and iteration. It introduces Python syntax, built-in data types like integers, floats, booleans and strings. It describes operators, variables, functions, conditional statements like if/else, and repetition with loops. Examples are provided to demonstrate concepts like arithmetic expressions, type conversion, scope of variables, parameter passing in functions, and handling errors from user input.
Introduction To Programming with PythonSushant Mane
The document provides an introduction to the Python programming language. It discusses Python's core features like being an interpreted, object-oriented, and dynamic language. It covers basic Python concepts like data types, variables, operators, control flow, functions, modules, file handling, and object-oriented programming. The document contains examples and explanations of built-in types like numbers, strings, lists, tuples, and dictionaries. It also discusses control structures, functions, modules, and classes in Python.
The document discusses various parts of the Python programming language including keywords, variables, operators, data types, and more. It provides examples and explanations of concepts like:
- Keywords are reserved words with specific uses like False, None, True, and, or, etc.
- Variables store values in reserved memory locations and can be of different data types like integers, floats, strings.
- Python supports common operators for arithmetic, comparison, logical, bitwise and other operations.
- Core data types include numbers, strings, lists, tuples, and dictionaries.
- Other concepts covered are indentation, comments, input/output functions, type conversions.
This document provides an introduction to the Python programming language. It discusses what Python is, why it should be used, and some key features like variables, data types, operators, conditional statements, loops, lists, tuples, modules and more. Examples are provided to demonstrate how each concept works in Python code. Links to Colab notebooks with additional Python examples and exercises are included at the end.
The document provides an introduction to Python programming and application development. It discusses that Python is an interpreted, high-level and object-oriented programming language. It then covers key Python concepts like data types, variables, operators, expressions and statements. The document also lists some common Python applications like data science, web development, AI and more.
This document provides an overview of the Python programming language and concepts like variables, data types, operators, conditional execution, functions, and iteration. It discusses key features of Python like it being an interpreted language, the Python virtual machine, differences between Python 2 and 3. It also covers topics like installing Python, using text editors, values and variable types, operators, expressions, conditional execution using if/else statements, exception handling with try/except, functions and their parameters/arguments. The document includes examples and activities for readers to practice the concepts.
A SEW-EURODRIVE brake repair kit is needed for maintenance and repair of specific SEW-EURODRIVE brake models, like the BE series. It includes all necessary parts for preventative maintenance and repairs. This ensures proper brake functionality and extends the lifespan of the brake system
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyYannis
The doctoral thesis trajectory has been often characterized as a “long and windy road” or a journey to “Ithaka”, suggesting the promises and challenges of this journey of initiation to research. The doctoral candidates need to complete such journey (i) preserving and even enhancing their wellbeing, (ii) overcoming the many challenges through resilience, while keeping (iii) high standards of ethics and (iv) scientific rigor. This talk will provide a personal account of lessons learnt and recommendations from a senior researcher over his 30+ years of doctoral supervision and care for doctoral students. Specific attention will be paid on the special features of the (i) interdisciplinary doctoral research that involves Information and Communications Technologies (ICT) and other scientific traditions, and (ii) the challenges faced in the complex technological and research landscape dominated by Artificial Intelligence.
First Review PPT gfinal gyft ftu liu yrfut goSowndarya6
CyberShieldX provides end-to-end security solutions, including vulnerability assessment, penetration testing, and real-time threat detection for business websites. It ensures that organizations can identify and mitigate security risks before exploitation.
Unlike traditional security tools, CyberShieldX integrates AI models to automate vulnerability detection, minimize false positives, and enhance threat intelligence. This reduces manual effort and improves security accuracy.
Many small and medium businesses lack dedicated cybersecurity teams. CyberShieldX provides an easy-to-use platform with AI-powered insights to assist non-experts in securing their websites.
Traditional enterprise security solutions are often expensive. CyberShieldX, as a SaaS platform, offers cost-effective security solutions with flexible pricing for businesses of all sizes.
Businesses must comply with security regulations, and failure to do so can result in fines or data breaches. CyberShieldX helps organizations meet compliance requirements efficiently.
Rearchitecturing a 9-year-old legacy Laravel application.pdfTakumi Amitani
An initiative to re-architect a Laravel legacy application that had been running for 9 years using the following approaches, with the goal of improving the system’s modifiability:
・Event Storming
・Use Case Driven Object Modeling
・Domain Driven Design
・Modular Monolith
・Clean Architecture
This slide was used in PHPxTKY June 2025.
https://phpxtky.connpass.com/event/352685/
This research presents a machine learning (ML) based model to estimate the axial strength of corroded RC columns reinforced with fiber-reinforced polymer (FRP) composites. Estimating the axial strength of corroded columns is complex due to the intricate interplay between corrosion and FRP reinforcement. To address this, a dataset of 102 samples from various literature sources was compiled. Subsequently, this dataset was employed to create and train the ML models. The parameters influencing axial strength included the geometry of the column, properties of the FRP material, degree of corrosion, and properties of the concrete. Considering the scarcity of reliable design guidelines for estimating the axial strength of RC columns considering corrosion effects, artificial neural network (ANN), Gaussian process regression (GPR), and support vector machine (SVM) techniques were employed. These techniques were used to predict the axial strength of corroded RC columns reinforced with FRP. When comparing the results of the proposed ML models with existing design guidelines, the ANN model demonstrated higher predictive accuracy. The ANN model achieved an R-value of 98.08% and an RMSE value of 132.69 kN which is the lowest among all other models. This model fills the existing gap in knowledge and provides a precise means of assessment. This model can be used in the scientific community by researchers and practitioners to predict the axial strength of FRP-strengthened corroded columns. In addition, the GPR and SVM models obtained an accuracy of 98.26% and 97.99%, respectively.
本資料「To CoT or not to CoT?」では、大規模言語モデルにおけるChain of Thought(CoT)プロンプトの効果について詳しく解説しています。
CoTはあらゆるタスクに効く万能な手法ではなく、特に数学的・論理的・アルゴリズム的な推論を伴う課題で高い効果を発揮することが実験から示されています。
一方で、常識や一般知識を問う問題に対しては効果が限定的であることも明らかになりました。
複雑な問題を段階的に分解・実行する「計画と実行」のプロセスにおいて、CoTの強みが活かされる点も注目ポイントです。
This presentation explores when Chain of Thought (CoT) prompting is truly effective in large language models.
The findings show that CoT significantly improves performance on tasks involving mathematical or logical reasoning, while its impact is limited on general knowledge or commonsense tasks.
This study will provide the audience with an understanding of the capabilities of soft tools such as Artificial Neural Networks (ANN), Support Vector Regression (SVR), Model Trees (MT), and Multi-Gene Genetic Programming (MGGP) as a statistical downscaling tool. Many projects are underway around the world to downscale the data from Global Climate Models (GCM). The majority of the statistical tools have a lengthy downscaling pipeline to follow. To improve its accuracy, the GCM data is re-gridded according to the grid points of the observed data, standardized, and, sometimes, bias-removal is required. The current work suggests that future precipitation can be predicted by using precipitation data from the nearest four grid points as input to soft tools and observed precipitation as output. This research aims to estimate precipitation trends in the near future (2021-2050), using 5 GCMs, for Pune, in the state of Maharashtra, India. The findings indicate that each one of the soft tools can model the precipitation with excellent accuracy as compared to the traditional method of Distribution Based Scaling (DBS). The results show that ANN models appear to give the best results, followed by MT, then MGGP, and finally SVR. This work is one of a kind in that it provides insights into the changing monsoon season in Pune. The anticipated average precipitation levels depict a rise of 300–500% in January, along with increases of 200-300% in February and March, and a 100-150% increase for April and December. In contrast, rainfall appears to be decreasing by 20-30% between June and September.
May 2025: Top 10 Read Articles Advanced Information Technologyijait
International journal of advanced Information technology (IJAIT) is a bi monthly open access peer-reviewed journal, will act as a major forum for the presentation of innovative ideas, approaches, developments, and research projects in the area advanced information technology applications and services. It will also serve to facilitate the exchange of information between researchers and industry professionals to discuss the latest issues and advancement in the area of advanced IT. Core areas of advanced IT and multi-disciplinary and its applications will be covered during the conferences.
May 2025: Top 10 Read Articles Advanced Information Technologyijait
Ad
‘How to develop Pythonic coding rather than Python coding – Logic Perspective’
1. Online Workshop on ‘How to develop
Pythonic coding rather than Python
coding – Logic Perspective’
21.7.20 Day 1 session 1
Dr. S.Mohideen Badhusha
Professor/ CSE department
Alva’s Institute Engineering and
Technology
Mijar, Moodbidri, Mangalore
1
3. 3
To acquire knowledge in basic programming
constructs in Python
To comprehend the concept of functions in Python
To practice the simple problems in programming
constructs and functions in Python
Objectives of the Day 1 session 1
4. 4
Introduction to Python
• Python - a general-purpose,Interpreted,
interactive, object-oriented and high-level
programming language.
• Fastest growing open source Programming
language
• Dynamically typed
• Versatile and can be adapted in DA,
ML,GUI,Software &Web development
• It was created by Guido van Rossum during
1985-1990.
4
5. 5
Python IDEs
• IDLE
• Pycharm
• Spyder
• Thonny
• Atom
• Anaconda -Jupyter Notebook, Ipython
for larger project in different domains.
• Google colab
5
7. 7
Comment lines
• Single comment line is # comment line
• Multiple comment lines triple single quotes or
triple double quotes ‘’’ or “””
• ‘’’ multiple comment lines
……
…. ‘’’
“““ This is the Program for blah
blah blah.- multiple comment line”””
# This is a program for adding 2 nos
7
8. 8
Multiple Assignment
• You can also assign to multiple names at the
same time.
>>> x, y = 2, 3
>>> x
2
>>> y
3
Swapping assignment in Python
x,y=y,x
8
9. 9
Reserved Words
(these words can’t be used as varibles)
9
and exec Not
as finally or
assert for pass
break from print
class global raise
continue if return
def import try
del in while
elif is with
else lambda yield
10. 10
Indentation and Blocks
• Python doesn't use braces({}) to
indicate blocks of code for class and
function definitions or flow control.
• Blocks of code are denoted by line
indentation, which is rigidly enforced.
• All statements within the block must
be indented the same level
10
11. 11
• Python uses white space and indents
to denote blocks of code
• Lines of code that begin a block end in
a colon:
• Lines within the code block are
indented at the same level
• To end a code block, remove the
indentation
12. 12
Dynamically Typed: Python determines the data types
of variable bindings in a program automatically.
But Python’s not casual about types, it
enforces the types of objects.
“Strongly Typed”
So, for example, you can’t just append an integer to a
string. You must first convert the integer to a string
itself.
x = “the answer is ” # Decides x is bound to a string.
y = 23 # Decides y is bound to an integer.
print (x + y) # Python will complain about this.
print (x + str(y)) # correct
Python data types
13. 13
Conditional Execution
• if and else
if v == c:
#do something based on the
condition
else:
#do something based on v != c
• elif allows for additional branching
if condition:
…...
elif another condition:
… 13
14. 14
# python program for finding greater of two numbers
a=int(input(‘Enter the first number’))
b=int(input(‘Enter the second number’))
if a>b:
print("The greater number is",a)
else:
print("The greater number is",b)
# for satisfying equality condition
if a>b:
print("The greater number is",a)
elif a==b:
print(“both numbers are equal",a)
else:
print(“The greater number is",b)
15. 15
Nested conditionals
One conditional can also be nested within
another. We could have written the three-branch
example like this:
a=int(input(‘Enter the first number’))
b=int(input(‘Enter the second number’))
if a==b:
print(“Both the numbers are equal",a)
else:
if a>b:
print(“The greater number is",a)
else:
print(“The greater number is",b)
16. 16
Variables, expressions, and statements
python
>>> print(4)
4
If you are not sure what type a value has, the
interpreter can tell you.
>>> type('Hello, World!')
<class 'str'>
>>> type(17)
<class 'int'>
>>> type(3.2)
<class 'float'>
>>> type('17')
<class 'str'>
>>> type('3.2')
<class 'str'>
17. 17
If you give a variable an illegal name, you get
a syntax error:
>>> 76trombones = 'big parade'
SyntaxError: invalid syntax
>>> more@ = 1000000
SyntaxError: invalid syntax
>>> class = 'Advanced Theoretical Zymurgy'
SyntaxError: invalid syntax
18. 18
Operators and operands
a=20 b=10
+ Addition Adds values on either side of the
operator.
a + b = 30
- Subtraction Subtracts right hand operand from
left hand operand.
a – b = -10
* Multiplication Multiplies values on either side of
the operator
a * b = 200
/ Division Divides left hand operand by right hand
operand
b / a = 0.5
19. 19
// Floor Division - The division of operands where the result
is the quotient in which the digits after the decimal point
are removed.
9//2 = 4 and 9.0//2.0 = 4.0
% Modulus Divides left hand operand by right hand
operand and returns remainder
a % b = 0
** Exponent Performs exponential power calculation on
operators
a**b =20 to the power 10
20. 20
Relational Operators
== equal to
!= or <> not equal to
> greater than
>=greater than or equal to
< less than
<= less than or equal to
21. 21
Python Assignment Operators
= Assigns values from right side operands
to left side operand c = a + b assigns value of a + b into c
+= Add AND It adds right operand to the left operand
and assign the result to left operand
c += a is equivalent to c = c + a
-= Subtract AND It subtracts right operand from the left
operand and assign the result to left operand c -= a is
equivalent to c = c – a
*= Multiply AND It multiplies right operand with the left
operand and assign the result to left operand c *= a is
equivalent to c = c * a
22. 22
/= Divide AND It divides left operand with the right
operand and assign the result to left operand c /= a is
equivalent to c = c / ac /= a is
equivalent to c = c / a
%= Modulus AND It takes modulus using two operands
and assign the result to left operand c %= a is
equivalent to c = c % a
**= Exponent Performs exponential power calculation on
operators and assign value to the left c **= a is
equivalent to c = c ** a
23. 23
The + operator works with strings, but it is not addition
in the mathematical sense.
Instead it performs concatenation, which means joining
the strings by linking them end to end. For example:
>>> first = 10
>>> second = 15
>>> print(first+second)
25
>>> first = '100'
>>> second = '150'
>>> print(first + second)
100150
24. 24
Functions
A function is a block of organized, reusable
code that is used to perform a single,
related action.
Functions provide better modularity for
your application and a high degree of code
reusing.
25. 25
Syntax for function definition
def functionname( parameters ):
function_suite
return [expression]
Example :
def great2(x,y) :
if x > y :
return x
else:
return y
Special feature of function in Python is that it can return
more than one value
26. 26
Calling the Function
def great2(x,y) :
if x > y :
return x
else:
return y
a=int(input(‘Enter a’))
b=int(input(‘Enter b’))
print(‘The greater number is’, great2(a,b))
27. 27
Catching exceptions using try and except
inp = input('Enter Fahrenheit Temperature:')
try:
fahr = float(inp)
cel = (fahr - 32.0) * 5.0 / 9.0
print(cel)
except:
print('Please enter a valid number')
28. 28
Concluding Tips
Interpreted ,Object oriented and open sourced
Programming language
Developed by Guido van Rossum during 1985-90
Dynamically typed but strongly typed language
Indented language which has no block level symbols {}
No ; is necessary . Block beginning starts with :
function starts with def key word followed by function
name and :
#- single comment line ’’’ or ””” - multiple comment line
if...else if...elif ...elif No endif
Multiple assignment x,y,z=2,4,5 is possible
/ - divide with precision //- floor division (no precision)