SlideShare a Scribd company logo
1 of 10
Conditions in python
‫إعداد‬:
‫م‬.‫محمد‬ ‫علي‬
Objective
 Inputs in python
 Ready functions in python
 Conditions in python
 If statement
Inputs in python
 First when we want to write a python program we must install a compiler
or must create a new python file and run it using the shell
 When we want to make user input from the keyboard we use the keyword
(input)
 Example: x=input()
 In this case the shell will wait us for input from keyboard
 We can show a message before input
 Example: y=input(‘input something’)
 Rule: every thing we input it from keyboard it
inputted as string
Ready functions in python
 After we input some thing from keyboard as string
 If we want to convert the input to another data type we must use some
ready function as:
 int(): to convert to int
 Example: int(x)…. Then x will be an int variable
 float(): to convert to float
 Example: float(y)…… then y will be a float variable
 str(): to convert to string
 Example: str(5)…. Then the 5 will be like ‘5’ as a string
 Rule: we can use this functions in print command
Conditions in python
 In python we have only (if statement)
 There is no switch….case statement
 If we want to implement (switch….case) statement we must create a new
function for this
 Rule: in python there is only if statement
If statement
 As all programming languages the if statement has the following syntax:
 if condition :
commands
If … else statement
 The syntax is:
 if condition:
command
 else:
command
If … elseif … else statement
 The syntax is:
 if condition:
command
 elif condition:
command
 else:
command
The biggest number
 x=5
 y=6
 z=10
 if x>y and x>z:
 print('the biggest number is: ',x)
 elif y>x and y>z:
 print('the biggest number is: ',y)
 else:
 print('the biggest number is: ',z)
The biggest number
 x=int(input('enter the first number: '))
 y=int(input('enter the second number: '))
 z=int(input('enter the third number: '))
 if x>y and x>z:
 print('the biggest number is x: ',x)
 elif y>x and y>z:
 print('the biggest number is y: ',y)
 else:
 print('the biggest number is z: ',z)

More Related Content

What's hot (20)

Python ppt
Python pptPython ppt
Python ppt
 
Iteration
IterationIteration
Iteration
 
Python unit 2 M.sc cs
Python unit 2 M.sc csPython unit 2 M.sc cs
Python unit 2 M.sc cs
 
Function
FunctionFunction
Function
 
Python numbers
Python numbersPython numbers
Python numbers
 
Dictionary
DictionaryDictionary
Dictionary
 
Python basics
Python basicsPython basics
Python basics
 
Iterators and Generators
Iterators and GeneratorsIterators and Generators
Iterators and Generators
 
Python Session - 4
Python Session - 4Python Session - 4
Python Session - 4
 
03 function overloading
03 function overloading03 function overloading
03 function overloading
 
Conditionalstatement
ConditionalstatementConditionalstatement
Conditionalstatement
 
Python Generators
Python GeneratorsPython Generators
Python Generators
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - Reference
 
Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5th
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Python overview
Python   overviewPython   overview
Python overview
 
Lesson 3 php numbers
Lesson 3  php numbersLesson 3  php numbers
Lesson 3 php numbers
 

Similar to Third session

controlstatementspy.docx
controlstatementspy.docxcontrolstatementspy.docx
controlstatementspy.docxmanohar25689
 
Python Decision Making And Loops.pdf
Python Decision Making And Loops.pdfPython Decision Making And Loops.pdf
Python Decision Making And Loops.pdfNehaSpillai1
 
The Input Statement in Core Python .pptx
The Input Statement in Core Python .pptxThe Input Statement in Core Python .pptx
The Input Statement in Core Python .pptxKavitha713564
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONvikram mahendra
 
if else python.pdf
if else python.pdfif else python.pdf
if else python.pdfGshs6
 
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONSINTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONSKalaivaniD12
 
Python programing
Python programingPython programing
Python programinghamzagame
 
conditionalanddvfvdfvdvdcontrolstatement-171023101126.pdf
conditionalanddvfvdfvdvdcontrolstatement-171023101126.pdfconditionalanddvfvdfvdvdcontrolstatement-171023101126.pdf
conditionalanddvfvdfvdvdcontrolstatement-171023101126.pdfsdvdsvsdvsvds
 
Input and Output Statements.pdf
Input and Output Statements.pdfInput and Output Statements.pdf
Input and Output Statements.pdfZahraAbdulAhmad
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statementnarmadhakin
 

Similar to Third session (20)

controlstatementspy.docx
controlstatementspy.docxcontrolstatementspy.docx
controlstatementspy.docx
 
Python revision tour i
Python revision tour iPython revision tour i
Python revision tour i
 
Python Decision Making And Loops.pdf
Python Decision Making And Loops.pdfPython Decision Making And Loops.pdf
Python Decision Making And Loops.pdf
 
The Input Statement in Core Python .pptx
The Input Statement in Core Python .pptxThe Input Statement in Core Python .pptx
The Input Statement in Core Python .pptx
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
 
if else python.pdf
if else python.pdfif else python.pdf
if else python.pdf
 
loops.pdf
loops.pdfloops.pdf
loops.pdf
 
pythonQuick.pdf
pythonQuick.pdfpythonQuick.pdf
pythonQuick.pdf
 
python notes.pdf
python notes.pdfpython notes.pdf
python notes.pdf
 
python 34💭.pdf
python 34💭.pdfpython 34💭.pdf
python 34💭.pdf
 
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONSINTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
 
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdfGE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
 
Python programing
Python programingPython programing
Python programing
 
Python-Cheat-Sheet.pdf
Python-Cheat-Sheet.pdfPython-Cheat-Sheet.pdf
Python-Cheat-Sheet.pdf
 
conditionalanddvfvdfvdvdcontrolstatement-171023101126.pdf
conditionalanddvfvdfvdvdcontrolstatement-171023101126.pdfconditionalanddvfvdfvdvdcontrolstatement-171023101126.pdf
conditionalanddvfvdfvdvdcontrolstatement-171023101126.pdf
 
Input and Output Statements.pdf
Input and Output Statements.pdfInput and Output Statements.pdf
Input and Output Statements.pdf
 
Control structures pyhton
Control structures  pyhtonControl structures  pyhton
Control structures pyhton
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
 
python
pythonpython
python
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 

More from AliMohammad155

#1 الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...
#1  الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...#1  الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...
#1 الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...AliMohammad155
 
شرح مبسط وبسيط لمفهوم ال VLAN
شرح مبسط وبسيط لمفهوم ال VLANشرح مبسط وبسيط لمفهوم ال VLAN
شرح مبسط وبسيط لمفهوم ال VLANAliMohammad155
 
11th session classes diagrams
11th session classes diagrams11th session classes diagrams
11th session classes diagramsAliMohammad155
 
Static route and rip and ospf
Static route and rip and ospfStatic route and rip and ospf
Static route and rip and ospfAliMohammad155
 
Ninth session software engineering sequence diagram
Ninth session software engineering sequence diagramNinth session software engineering sequence diagram
Ninth session software engineering sequence diagramAliMohammad155
 
Routers and packet tracer
Routers and packet tracerRouters and packet tracer
Routers and packet tracerAliMohammad155
 
Viii session activity diagram
Viii session activity diagramViii session activity diagram
Viii session activity diagramAliMohammad155
 
Seventh session functional and non functional requrements & usecase example
Seventh session functional and non functional requrements & usecase exampleSeventh session functional and non functional requrements & usecase example
Seventh session functional and non functional requrements & usecase exampleAliMohammad155
 
Sixth session software engineering usecase diagrams
Sixth session software engineering usecase diagramsSixth session software engineering usecase diagrams
Sixth session software engineering usecase diagramsAliMohammad155
 
fifth session in networking subnetmask and subnetting
fifth session in networking subnetmask and subnettingfifth session in networking subnetmask and subnetting
fifth session in networking subnetmask and subnettingAliMohammad155
 
functional requirements and non functional requirements
functional requirements and non functional requirementsfunctional requirements and non functional requirements
functional requirements and non functional requirementsAliMohammad155
 
fourth session of basics in networks
fourth session of basics in networksfourth session of basics in networks
fourth session of basics in networksAliMohammad155
 
Fourth session software engineering
Fourth session software engineeringFourth session software engineering
Fourth session software engineeringAliMohammad155
 
third session of basics in networks
third session of basics in networksthird session of basics in networks
third session of basics in networksAliMohammad155
 
Third session software engineering
Third session software engineeringThird session software engineering
Third session software engineeringAliMohammad155
 
Second session Networking (Network topology)
Second session Networking (Network topology)Second session Networking (Network topology)
Second session Networking (Network topology)AliMohammad155
 
Second session software engineering algorithms
Second session software engineering   algorithmsSecond session software engineering   algorithms
Second session software engineering algorithmsAliMohammad155
 

More from AliMohammad155 (20)

#1 الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...
#1  الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...#1  الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...
#1 الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...
 
شرح مبسط وبسيط لمفهوم ال VLAN
شرح مبسط وبسيط لمفهوم ال VLANشرح مبسط وبسيط لمفهوم ال VLAN
شرح مبسط وبسيط لمفهوم ال VLAN
 
11th session classes diagrams
11th session classes diagrams11th session classes diagrams
11th session classes diagrams
 
10th session erd
10th session erd10th session erd
10th session erd
 
Static route and rip and ospf
Static route and rip and ospfStatic route and rip and ospf
Static route and rip and ospf
 
Ninth session software engineering sequence diagram
Ninth session software engineering sequence diagramNinth session software engineering sequence diagram
Ninth session software engineering sequence diagram
 
Routers and packet tracer
Routers and packet tracerRouters and packet tracer
Routers and packet tracer
 
Viii session activity diagram
Viii session activity diagramViii session activity diagram
Viii session activity diagram
 
OSI Model
OSI ModelOSI Model
OSI Model
 
Seventh session functional and non functional requrements & usecase example
Seventh session functional and non functional requrements & usecase exampleSeventh session functional and non functional requrements & usecase example
Seventh session functional and non functional requrements & usecase example
 
Vlsm and flsm example
Vlsm and flsm exampleVlsm and flsm example
Vlsm and flsm example
 
Sixth session software engineering usecase diagrams
Sixth session software engineering usecase diagramsSixth session software engineering usecase diagrams
Sixth session software engineering usecase diagrams
 
fifth session in networking subnetmask and subnetting
fifth session in networking subnetmask and subnettingfifth session in networking subnetmask and subnetting
fifth session in networking subnetmask and subnetting
 
functional requirements and non functional requirements
functional requirements and non functional requirementsfunctional requirements and non functional requirements
functional requirements and non functional requirements
 
fourth session of basics in networks
fourth session of basics in networksfourth session of basics in networks
fourth session of basics in networks
 
Fourth session software engineering
Fourth session software engineeringFourth session software engineering
Fourth session software engineering
 
third session of basics in networks
third session of basics in networksthird session of basics in networks
third session of basics in networks
 
Third session software engineering
Third session software engineeringThird session software engineering
Third session software engineering
 
Second session Networking (Network topology)
Second session Networking (Network topology)Second session Networking (Network topology)
Second session Networking (Network topology)
 
Second session software engineering algorithms
Second session software engineering   algorithmsSecond session software engineering   algorithms
Second session software engineering algorithms
 

Recently uploaded

Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdfMuhammad Subhan
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistandanishmna97
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data SciencePaolo Missier
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهMohamed Sweelam
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 

Recently uploaded (20)

Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 

Third session

  • 2. Objective  Inputs in python  Ready functions in python  Conditions in python  If statement
  • 3. Inputs in python  First when we want to write a python program we must install a compiler or must create a new python file and run it using the shell  When we want to make user input from the keyboard we use the keyword (input)  Example: x=input()  In this case the shell will wait us for input from keyboard  We can show a message before input  Example: y=input(‘input something’)  Rule: every thing we input it from keyboard it inputted as string
  • 4. Ready functions in python  After we input some thing from keyboard as string  If we want to convert the input to another data type we must use some ready function as:  int(): to convert to int  Example: int(x)…. Then x will be an int variable  float(): to convert to float  Example: float(y)…… then y will be a float variable  str(): to convert to string  Example: str(5)…. Then the 5 will be like ‘5’ as a string  Rule: we can use this functions in print command
  • 5. Conditions in python  In python we have only (if statement)  There is no switch….case statement  If we want to implement (switch….case) statement we must create a new function for this  Rule: in python there is only if statement
  • 6. If statement  As all programming languages the if statement has the following syntax:  if condition : commands
  • 7. If … else statement  The syntax is:  if condition: command  else: command
  • 8. If … elseif … else statement  The syntax is:  if condition: command  elif condition: command  else: command
  • 9. The biggest number  x=5  y=6  z=10  if x>y and x>z:  print('the biggest number is: ',x)  elif y>x and y>z:  print('the biggest number is: ',y)  else:  print('the biggest number is: ',z)
  • 10. The biggest number  x=int(input('enter the first number: '))  y=int(input('enter the second number: '))  z=int(input('enter the third number: '))  if x>y and x>z:  print('the biggest number is x: ',x)  elif y>x and y>z:  print('the biggest number is y: ',y)  else:  print('the biggest number is z: ',z)