DEV Community

R.Shobika CSE
R.Shobika CSE

Posted on

PYTHON3 DAY-5

Comparison Operator:

  • In Python Relation operator is used to compare the two values (<,>,<=,>=,==)

Example:1:

Example:2:

output:


Example:3:

Ternary Operator:

  • In Ternary operator allow you to assing one value if a condition is true it print a true statement otherwise it print a false statement

Example :

Logical Operator:

  • Logical operator are used to combine a conditional statement, In python Logical operator has a 3 type

  • and ---> this operator check when the both side condition has a True it give the output True , if anyone condition is False means it give the output False.

  • or ----> this operator check the condition if anyone condition True means it give the output as True if both side condition is False means it give False.

  • not---> Reverses the result, returns False if the result is true

Example:

What is Run time?

  • Runtime means the time when a computer program is actively running, or the software environment that lets it run

  • Runtime is when the finished program actually performs its tasks for the user

What is Compile time?

  • Compile time is the period when a compiler program translates human-readable source code into machine-readable binary code, syntax and semantic checks occur, and compile-time errors are found

What is System Language?

  • System Language is a 0's and 1's (signals)

Python Input: [TBD]

  • In Python Input is a function we can get the input from the user

 \

Function

  • Function is a block of code only run when it is called

  • Its is used for code repetition

how to define a function?

  • In python using the def keyword to define a function
def function_name(Parameters):
Enter fullscreen mode Exit fullscreen mode

how to call a function ?

  • In python we have to call a function in a function name

  • In Python we can call a function in multiple times

def play():
   print("play a song")
play()
Enter fullscreen mode Exit fullscreen mode

how to return a function?

  • A Function send back the code to the called them

  • when function reaches the return statement it stop the executing and send the result back

def cafe(amount):
  print("Amount Paid : ",amount)
  print("order received")
  return "iced americano"
x=cafe(250)
print(x)
Enter fullscreen mode Exit fullscreen mode

Output:
Amount Paid : 250
order received
iced americano

To Be Discussed:

  • Identity operator

  • Membership operator

  • Bitwise operator

Top comments (0)