0% found this document useful (0 votes)
9 views

Module

Uploaded by

arunveeruma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Module

Uploaded by

arunveeruma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

MODULE -1-PP

 Entering Expressions into the Interactive Shell : The Python interactive


shell is an ideal environment for experimenting and learning. You can
launch the shell by typing python or python3 in your terminal or
command prompt. You'll see a prompt (>>>) where you can enter
expression.
 You can check the data type of a value using the type() function:
 Input Function: The input() function allows users to provide data. The
entered name is stored in the variable name.
 Print Function: The print() function outputs text to the console. We
concatenate strings to create a personalized greeting.
 Variable Usage: We use the variable name in the print() function to
incorporate the user’s input into the message.
 The len() function returns the number of characters in the input string.
 Flow control determines the order in which statements are executed in a
program based on certain conditions.
 Boolean values represent truth values: True or False. In Python, these are
fundamental to controlling the flow of programs.
 Comparison operators are used to compare two values. They return a
Boolean value (True or False). Here are the primary comparison
operators:
 Equal to (==): Checks if two values are equal.
  Not equal to (!=): Checks if two values are not equal.
  Greater than (>): Checks if the left value is greater than the right.
  Less than (=): Checks if the left value is greater than or equal to the
right.
  Less than or equal to (<=): Checks if the left value is less than or equal
to the right.
 The three primary Boolean operators are:
 AND (and): Returns True if both operands are true.
 OR (or): Returns True if at least one operand is true.
 NOT (not): Inverts the Boolean value.
 If you need to terminate a program before it reaches the end, you can use
sys.exit(). This is particularly useful in situations where an error occurs.

You might also like