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.
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.
Operators and expressions are fundamental concepts in Python programming. The document discusses various types of operators used to manipulate operands, including arithmetic, comparison, assignment, logical, bitwise, and membership operators. It also covers expressions, which are combinations of operators and operands that evaluate to a value. Several types of expressions are described, such as constant, arithmetic, integral, floating, relational, logical, bitwise, and combinational expressions. Control flow statements like if, if-else, if-elif-else are also covered, along with looping using for and while loops and the break, continue, and pass statements.
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.
Python uses indentation to define code blocks for decision making statements like if, elif and else. The if statement executes code if a condition is true, elif allows checking multiple conditions, and else runs code if all conditions are false. Loops like while and for repeat code, with while looping until a condition is false and for iterating over a sequence. Nested loops can run inner loops multiple times during outer loop iterations. The else block after a for runs if all iterations complete without breaking from the loop.
This document provides an overview of key concepts in programming and Python. It defines terms like code, syntax, output, console, compiling, interpreting, and variables. It explains Python as an interpreted language and shows examples of printing output, taking user input, performing calculations with numbers and math commands, using variables, and basic control structures like if/else and loops. It also covers data types like integers, floats, strings, lists, and how to modify and format them.
The document provides an introduction to programming with Python. It discusses key concepts like code, syntax, output, and consoles. It also covers compiling vs interpreting languages, with Python being an interpreted language. The document explains expressions, variables, basic math operations, and functions in Python like print and input. It introduces control structures like if/else statements, for loops, and while loops. It also covers different data types in Python including numbers, strings, lists, and dictionaries.
Python is an interpreted programming language that can be used to perform calculations, handle text, and control program flow. It allows variables to store values that can later be used in expressions. Common operations include arithmetic, printing output, accepting user input, and repeating tasks using for loops and conditional statements like if/else. The interpreter executes Python code directly without a separate compilation step required by other languages.
The document provides an introduction to programming with Python. It discusses key concepts like code, syntax, output, and consoles. It also covers compiling vs interpreting languages, with Python being an interpreted language. The document explains expressions, variables, basic math operations, and functions in Python like print and input. It introduces control structures like if/else statements and for/while loops. It also covers different data types in Python including numbers, strings, lists, and dictionaries.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This document provides an overview of key Python concepts including operators and expressions, data types, variables, functions, program flow, and input/output. It discusses operators like +, -, *, / and comparison operators. It explains that Python has different data types like integers, floats, booleans and strings. Variables are used to store and reference data. Functions allow for code reuse and modularization. Control structures like if statements allow programs to make decisions based on conditional logic.
Python is a general purpose programming language that can be used for both programming and scripting. It is an interpreted language, meaning code is executed line by line by the Python interpreter. Python code is written in plain text files with a .py extension. Key features of Python include being object-oriented, using indentation for code blocks rather than brackets, and having a large standard library. Python code can be used for tasks like system scripting, web development, data analysis, and more.
This document provides an overview of the basics of Python. It discusses code or source code, syntax, output, the console, compiling vs interpreting, the Python interpreter, expressions, operators, integer and real numbers, math commands, variables, print statements, input, the for loop, range, if/else statements, while loops, logic, and loop control statements. It also covers data types like numbers, strings, lists, sets, and dictionaries.
Provides an introductory level understanding of the Python Programming Language and language features. Serves as a guide for beginners and a reference to Python basics and language use cases.
The document describes a modular C programming directory structure that contains subdirectories for different C programming concepts like arrays, functions, strings, structures, etc. Each subdirectory contains C source code files that demonstrate examples for the given concept. The document also provides brief introductions and explanations for basic C programming topics like variables, data types, operators, decision making statements, loops, functions and pointers.
The document discusses different types of loops in Python including while loops, for loops, and infinite loops. It provides examples of using while loops to iterate until a condition is met, using for loops to iterate over a set of elements when the number of iterations is known, and how to terminate loops early using break or skip iterations using continue. It also discusses using the range() function to generate a sequence of numbers to iterate over in for loops.
This Programming Language Python Tutorial is very well suited for beginners and also for experienced programmers. This specially designed free Python tutorial will help you learn Python programming most efficiently, with all topics from basics to advanced (like Web-scraping, Django, Learning, etc.) with examples.
What is Python?
Python is a high-level, general-purpose, and very popular programming language. Python programming language (latest Python 3) is being used in web development, and Machine Learning applications, along with all cutting-edge technology in Software Industry. Python language is being used by almost all tech-giant companies like – Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc.
Writing your first Python Program to Learn PythonSetting up Python
Download and Install Python 3 Latest Version
How to set up Command Prompt for Python in Windows10
Setup Python VS Code or PyCharm
Creating Python Virtual Environment in Windows and Linux
Note: Python 3.13 is the latest version of Python, but Python 3.12 is the latest stable version.
Now let us deep dive into the basics and components to learn Python Programming:
Getting Started with Python Programming
Welcome to the Python tutorial section! Here, we’ll cover the essential elements you need to kickstart your journey in Python programming. From syntax and keywords to comments, variables, and indentation, we’ll explore the foundational concepts that underpin Python development.
Learn Python Basics
Syntax
Keywords in Python
Comments in Python
Learn Python Variables
Learn Python Data Types
Indentation and why is it important in Python
Learn Python Input/Output
In this segment, we delve into the fundamental aspects of handling input and output operations in Python, crucial for interacting with users and processing data effectively. From mastering the versatile print() function to exploring advanced formatting techniques and efficient methods for receiving user input, this section equips you with the necessary skills to harness Python’s power in handling data streams seamlessly.
Python print() function
The document defines various tokens in the C programming language including keywords, identifiers, constants, string literals, operators, data types, and variables. It discusses the basic data types like integers, floating point numbers, and characters. It also covers topics like declarations, global and local variables, type conversions, precedence and order of evaluation, and various operators used in C.
Python programming language provides the following types of loops to handle looping requirements:
1. While
2. Do While
3. For loop
Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time.
First in the series of slides for python programming, covering topics like programming language, python programming constructs, loops and control statements.
This document provides a quick tour of the Python programming language. It introduces basic Python concepts like data types, variables, operators, conditional statements, loops, and functions. It explains how to get user input, perform type conversions, and work with common data types like integers, floats, strings, and booleans. It also demonstrates how to define functions, use default arguments and keyword arguments, and handle global variables. The document uses examples to illustrate concepts like arithmetic operations, string slicing, indexing, concatenation, and repetition.
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdfComputer Programmer
This document provides an overview of various fundamental concepts in problem solving and computer programming, including data types, operators, control flow statements, arrays, and functions. It describes the different types of data types like integer, floating point, character, boolean, derived, and user-defined types. It also explains various categories of operators like unary, binary, arithmetic, relational, logical, and bitwise operators. Additionally, it covers decision making statements, loops, jumping statements, and escape sequences to control program flow. The document also discusses arrays, pointers, functions, and classes.
This document provides an overview of key concepts in programming and Python. It defines terms like code, syntax, output, console, compiling, interpreting, and variables. It explains Python as an interpreted language and shows examples of printing output, taking user input, performing calculations with numbers and math commands, using variables, and basic control structures like if/else and loops. It also covers data types like integers, floats, strings, lists, and how to modify and format them.
The document provides an introduction to programming with Python. It discusses key concepts like code, syntax, output, and consoles. It also covers compiling vs interpreting languages, with Python being an interpreted language. The document explains expressions, variables, basic math operations, and functions in Python like print and input. It introduces control structures like if/else statements, for loops, and while loops. It also covers different data types in Python including numbers, strings, lists, and dictionaries.
Python is an interpreted programming language that can be used to perform calculations, handle text, and control program flow. It allows variables to store values that can later be used in expressions. Common operations include arithmetic, printing output, accepting user input, and repeating tasks using for loops and conditional statements like if/else. The interpreter executes Python code directly without a separate compilation step required by other languages.
The document provides an introduction to programming with Python. It discusses key concepts like code, syntax, output, and consoles. It also covers compiling vs interpreting languages, with Python being an interpreted language. The document explains expressions, variables, basic math operations, and functions in Python like print and input. It introduces control structures like if/else statements and for/while loops. It also covers different data types in Python including numbers, strings, lists, and dictionaries.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This document provides an overview of key Python concepts including operators and expressions, data types, variables, functions, program flow, and input/output. It discusses operators like +, -, *, / and comparison operators. It explains that Python has different data types like integers, floats, booleans and strings. Variables are used to store and reference data. Functions allow for code reuse and modularization. Control structures like if statements allow programs to make decisions based on conditional logic.
Python is a general purpose programming language that can be used for both programming and scripting. It is an interpreted language, meaning code is executed line by line by the Python interpreter. Python code is written in plain text files with a .py extension. Key features of Python include being object-oriented, using indentation for code blocks rather than brackets, and having a large standard library. Python code can be used for tasks like system scripting, web development, data analysis, and more.
This document provides an overview of the basics of Python. It discusses code or source code, syntax, output, the console, compiling vs interpreting, the Python interpreter, expressions, operators, integer and real numbers, math commands, variables, print statements, input, the for loop, range, if/else statements, while loops, logic, and loop control statements. It also covers data types like numbers, strings, lists, sets, and dictionaries.
Provides an introductory level understanding of the Python Programming Language and language features. Serves as a guide for beginners and a reference to Python basics and language use cases.
The document describes a modular C programming directory structure that contains subdirectories for different C programming concepts like arrays, functions, strings, structures, etc. Each subdirectory contains C source code files that demonstrate examples for the given concept. The document also provides brief introductions and explanations for basic C programming topics like variables, data types, operators, decision making statements, loops, functions and pointers.
The document discusses different types of loops in Python including while loops, for loops, and infinite loops. It provides examples of using while loops to iterate until a condition is met, using for loops to iterate over a set of elements when the number of iterations is known, and how to terminate loops early using break or skip iterations using continue. It also discusses using the range() function to generate a sequence of numbers to iterate over in for loops.
This Programming Language Python Tutorial is very well suited for beginners and also for experienced programmers. This specially designed free Python tutorial will help you learn Python programming most efficiently, with all topics from basics to advanced (like Web-scraping, Django, Learning, etc.) with examples.
What is Python?
Python is a high-level, general-purpose, and very popular programming language. Python programming language (latest Python 3) is being used in web development, and Machine Learning applications, along with all cutting-edge technology in Software Industry. Python language is being used by almost all tech-giant companies like – Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc.
Writing your first Python Program to Learn PythonSetting up Python
Download and Install Python 3 Latest Version
How to set up Command Prompt for Python in Windows10
Setup Python VS Code or PyCharm
Creating Python Virtual Environment in Windows and Linux
Note: Python 3.13 is the latest version of Python, but Python 3.12 is the latest stable version.
Now let us deep dive into the basics and components to learn Python Programming:
Getting Started with Python Programming
Welcome to the Python tutorial section! Here, we’ll cover the essential elements you need to kickstart your journey in Python programming. From syntax and keywords to comments, variables, and indentation, we’ll explore the foundational concepts that underpin Python development.
Learn Python Basics
Syntax
Keywords in Python
Comments in Python
Learn Python Variables
Learn Python Data Types
Indentation and why is it important in Python
Learn Python Input/Output
In this segment, we delve into the fundamental aspects of handling input and output operations in Python, crucial for interacting with users and processing data effectively. From mastering the versatile print() function to exploring advanced formatting techniques and efficient methods for receiving user input, this section equips you with the necessary skills to harness Python’s power in handling data streams seamlessly.
Python print() function
The document defines various tokens in the C programming language including keywords, identifiers, constants, string literals, operators, data types, and variables. It discusses the basic data types like integers, floating point numbers, and characters. It also covers topics like declarations, global and local variables, type conversions, precedence and order of evaluation, and various operators used in C.
Python programming language provides the following types of loops to handle looping requirements:
1. While
2. Do While
3. For loop
Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time.
First in the series of slides for python programming, covering topics like programming language, python programming constructs, loops and control statements.
This document provides a quick tour of the Python programming language. It introduces basic Python concepts like data types, variables, operators, conditional statements, loops, and functions. It explains how to get user input, perform type conversions, and work with common data types like integers, floats, strings, and booleans. It also demonstrates how to define functions, use default arguments and keyword arguments, and handle global variables. The document uses examples to illustrate concepts like arithmetic operations, string slicing, indexing, concatenation, and repetition.
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdfComputer Programmer
This document provides an overview of various fundamental concepts in problem solving and computer programming, including data types, operators, control flow statements, arrays, and functions. It describes the different types of data types like integer, floating point, character, boolean, derived, and user-defined types. It also explains various categories of operators like unary, binary, arithmetic, relational, logical, and bitwise operators. Additionally, it covers decision making statements, loops, jumping statements, and escape sequences to control program flow. The document also discusses arrays, pointers, functions, and classes.
The Fluke 925 is a vane anemometer, a handheld device designed to measure wind speed, air flow (volume), and temperature. It features a separate sensor and display unit, allowing greater flexibility and ease of use in tight or hard-to-reach spaces. The Fluke 925 is particularly suitable for HVAC (heating, ventilation, and air conditioning) maintenance in both residential and commercial buildings, offering a durable and cost-effective solution for routine airflow diagnostics.
The role of the lexical analyzer
Specification of tokens
Finite state machines
From a regular expressions to an NFA
Convert NFA to DFA
Transforming grammars and regular expressions
Transforming automata to grammars
Language for specifying lexical analyzers
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxRishavKumar530754
LiDAR-Based System for Autonomous Cars
Autonomous Driving with LiDAR Tech
LiDAR Integration in Self-Driving Cars
Self-Driving Vehicles Using LiDAR
LiDAR Mapping for Driverless Cars
☁️ GDG Cloud Munich: Build With AI Workshop - Introduction to Vertex AI! ☁️
Join us for an exciting #BuildWithAi workshop on the 28th of April, 2025 at the Google Office in Munich!
Dive into the world of AI with our "Introduction to Vertex AI" session, presented by Google Cloud expert Randy Gupta.
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfMohamedAbdelkader115
Glad to be one of only 14 members inside Kuwait to hold this credential.
Please check the members inside kuwait from this link:
https://www.rics.org/networking/find-a-member.html?firstname=&lastname=&town=&country=Kuwait&member_grade=(AssocRICS)&expert_witness=&accrediation=&page=1
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...Infopitaara
A Boiler Feed Pump (BFP) is a critical component in thermal power plants. It supplies high-pressure water (feedwater) to the boiler, ensuring continuous steam generation.
⚙️ How a Boiler Feed Pump Works
Water Collection:
Feedwater is collected from the deaerator or feedwater tank.
Pressurization:
The pump increases water pressure using multiple impellers/stages in centrifugal types.
Discharge to Boiler:
Pressurized water is then supplied to the boiler drum or economizer section, depending on design.
🌀 Types of Boiler Feed Pumps
Centrifugal Pumps (most common):
Multistage for higher pressure.
Used in large thermal power stations.
Positive Displacement Pumps (less common):
For smaller or specific applications.
Precise flow control but less efficient for large volumes.
🛠️ Key Operations and Controls
Recirculation Line: Protects the pump from overheating at low flow.
Throttle Valve: Regulates flow based on boiler demand.
Control System: Often automated via DCS/PLC for variable load conditions.
Sealing & Cooling Systems: Prevent leakage and maintain pump health.
⚠️ Common BFP Issues
Cavitation due to low NPSH (Net Positive Suction Head).
Seal or bearing failure.
Overheating from improper flow or recirculation.
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...Infopitaara
A feed water heater is a device used in power plants to preheat water before it enters the boiler. It plays a critical role in improving the overall efficiency of the power generation process, especially in thermal power plants.
🔧 Function of a Feed Water Heater:
It uses steam extracted from the turbine to preheat the feed water.
This reduces the fuel required to convert water into steam in the boiler.
It supports Regenerative Rankine Cycle, increasing plant efficiency.
🔍 Types of Feed Water Heaters:
Open Feed Water Heater (Direct Contact)
Steam and water come into direct contact.
Mixing occurs, and heat is transferred directly.
Common in low-pressure stages.
Closed Feed Water Heater (Surface Type)
Steam and water are separated by tubes.
Heat is transferred through tube walls.
Common in high-pressure systems.
⚙️ Advantages:
Improves thermal efficiency.
Reduces fuel consumption.
Lowers thermal stress on boiler components.
Minimizes corrosion by removing dissolved gases.
Value Stream Mapping Worskshops for Intelligent Continuous SecurityMarc Hornbeek
This presentation provides detailed guidance and tools for conducting Current State and Future State Value Stream Mapping workshops for Intelligent Continuous Security.
2. 2
Python divides the operators in the following groups:
•Arithmetic operators
•Assignment operators
•Comparison operators
•Logical operators
•Identity operators
•Membership operators
•Bitwise operators
3. 3
Arithmetic Operators
Operator Name Example
+ Addition x + y
- Subtraction x - y
* Multiplication x * y
/ Division x / y
% Modulus x % y
** Exponentiation x ** y
// Floor division x // y
4. 4
#the floor division // rounds the result down to
the nearest whole number
x = 5
y = 3
print(x + y)
print(x-y)
print(x*y)
print(x/y)
print(x%y)
print(x**y)
print(x//y)
Arithmetic Operators Example:
5. 5
Assignment Operators:
Assignment operators are used to assign values to variables:
Operator Example Same As
= x = 5 x = 5
+= x += 3 x = x + 3
-= x -= 3 x = x - 3
*= x *= 3 x = x * 3
/= x /= 3 x = x / 3
%= x %= 3 x = x % 3
7. 7
Comparison Operators
Operator Name Example
== Equal x == y
!= Not equal x != y
> Greater than x > y
< Less than x < y
>= Greater than or equal to x >= y
<= Less than or equal to x <= y
Comparison operators are used to compare two values:
8. 8
x = 6
y = 4
print(x == y)
print(x!=y)
print(x>y)
print(x>= y)
print(x<y)
print(x<=y)
Comparison Operators Example:
9. 9
Logical Operators
Operator Description Example
and Returns True if both
statements are true
x < 5 and x < 10
or Returns True if one of the
statements is true
x < 5 or x < 4
not Reverse the result, returns
False if the result is true
not(x < 5 and x < 10)
Logical operators are used to combine conditional statements:
10. 10
x = 5
print(x > 2 and x < 10)
print(x > 2 or x < 10)
print(not(x > 2 and x < 10))
Logical Operators Example:
12. 12
Identity Operators
Operator Description Example
is Returns True if both
variables are the same
object
x is y
is not Returns True if both
variables are not the same
object
x is not y
Identity operators are used to compare the objects, not if they are equal, but if they are
actually the same object, with the same memory location:
13. 13
Membership Operators
Membership operators are used to test if a sequence is presented in an object:
Operator Description Example
in Returns True if a sequence
with the specified value is
present in the object
x in y
not in Returns True if a sequence
with the specified value is
not present in the object
x not in y
15. 15
Indentation
Whitespace at the beginning of the line is called indentation.These whitespaces or the indentation are very
important in Python. In a Python program, the leading whitespace including spaces and tabs at the
beginning of the logical line determines the indentation level of that logical line.
Example:
16. 16
Conditional Statements
CONDITIONAL EXECUTION (IF…)
Conditional execution (if…)
Syntax:
if condition:
do_something
Condition must be statement that evaluates
to a boolean value (True or False)
17. 17
Example:
Indentation:
Python relies on indentation (whitespace at the beginning of a line) to define
scope in the code. Other programming languages often use curly-brackets {}
for this purpose.
By default Python puts 4 spaces but it can be changed by programmers.
a=55
b=500
if b>a:
print("b is greater than a")
20. 20
If-elif-else Statement
Python supports if-elif-else statements to test additional conditions apart from the initial test expression.
The if-elif-else construct works in the same way as a usual if-else statement. If-elif-else construct is also
known as nested-if construct.
Example:
21. 21
num=int(input("Enter any number:"))
if num==0:
print("The value is equal to zero")
elif num>0:
print("The number is positive")
else:
print("The number is negative")
Example:
24. 24
Python end parameter in print()
By default python’s print() function ends with a newline. Python’s print() function comes with a parameter
called ‘end’. By default, the value of this parameter is ‘n’, i.e. the new line character. You can end a print
statement with any character/string using this parameter.
i=1
while(i<=10):
print(i,end=" ")
i=i+1
25. 25
For Loop
For loop provides a mechanism to repeat a task until a particular condition isTrue. It is usually known as a
determinate or definite loop because the programmer knows exactly how many times the loop will repeat.
The for...in statement is a looping statement used in Python to iterate over a sequence of objects.
26. 26
For Loop and Range() Function
The range() function is a built-in function in Python that is used to iterate over a sequence of numbers.The
syntax of range() is range(beg, end, [step])
The range() produces a sequence of numbers starting with beg (inclusive) and ending with one less than the
number end.The step argument is option (that is why it is placed in brackets). By default, every number in
the range is incremented by 1 but we can specify a different increment using step. It can be both negative and
positive, but not zero.
If range() function is given a single argument, it produces an object with values from 0 to argument-1. For
example: range(10) is equal to writing range(0, 10).
• If range() is called with two arguments, it produces values from the first to the second. For example,
range(0,10).
• If range() has three arguments then the third argument specifies the interval of the sequence produced.
In this case, the third argument must be an integer. For example, range(1,20,3).
27. 27
Examples:
for i in range(10):
print(i,end=" ")
for i in range(1,10):
print(i,end=" ")
for i in range(0,10,2):
print(i,end=" ")
Output:
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
0 2 4 6 8
28. 28
Nested Loops
Python allows its users to have nested loops, that is, loops that can be placed inside other loops.Although this
feature will work with any loop like while loop as well as for loop.
A for loop can be used to control the number of times a particular set of statements will be executed.
Another outer loop could be used to control the number of times that a whole loop is repeated.
Loops should be properly indented to identify which statements are contained within each for statement.
Example:
for i in range(5):
print()
for j in range(5):
print("*",end=" ")
output
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
32. 32
write a program to check entered number is prime or not
num=int(input("Enter a number"))
i=2
while(num%i!=0):
i=i+1
if i==num:
print("Prime number")
else:
print("Not prime")
33. 33
Write a program to print following Pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
rows = 6
for num in range(1,rows):
for i in range(num):
print(num, end=" ") # print number
# line after each row to display pattern correctly
print(" ")
34. 34
Pass statement
In Python programming, the pass statement is a null statement. The difference between
a comment and a pass statement in Python is that while the interpreter ignores a comment
entirely, pass is not ignored.
However, nothing happens when the pass is executed. It results in no operation (NOP)
Suppose we have a loop or a function that is not implemented yet, but we want to implement
it in the future. They cannot have an empty body. The interpreter would give an error. So, we
use the pass statement to construct a body that does nothing.
Example:
def function(args):
pass
Example:
class abc:
pass