Armstrong Strong&Weak Palindrome Matrix
Armstrong Strong&Weak Palindrome Matrix
Objectives:
1. Introduce oneself to Engineering Tool Python Software.
2. Acquire fundamental knowledge of Python for Numerical Analysis.
3. Employ Python for tackling intricate problems.
4. Investigate the practical application of Variables, Loops, Conditional Statements, and
Arrays in problem-solving scenarios.
5. Address mathematical challenges such as Matrix Multiplication using Python.
6. Develop robust logical reasoning for Problem Solving and Numerical Analysis.
7. Grasp the fundamental principles governing the creation of algorithms for problem-
solving purposes.
Introduction: Python, a high-level and versatile programming language renowned for its
readability, simplicity, and extensive libraries, has garnered significant popularity. In this
introductory overview, we'll delve into fundamental concepts that underpin Python
programming.
Variables
• Acting as symbolic containers for data storage, variables are declared using meaningful names
and assigned values.
For instance:
x = “Sadia”
y = 15
print(x)
print(y)
Variables in Python do not require declaration with specific types and can dynamically change
types even after initialization.
Data Types
Python offers support for a variety of data types:
Integers: Represent whole numbers (77, -70)
Floats: Represent decimal numbers (3.1416, -0.89)
Strings: Represent sequences of characters ("Hello, programmers!")
Lists: Represent ordered collections ([1, 2, 3, 4, 5])
Tuples: Represent immutable ordered collections (10, 20, 30)
Dictionaries: Represent key-value pairs ({"name": "Sadia", "age": 21})
4. Lists
Lists facilitate the dynamic storage of multiple elements.
Common operations involve indexing, slicing, and appending.
For example:
departments = ["CSE", "BBA", "EEE, CE, ME, English"]
print(departments)
5. Strings
Strings represent text and are enclosed within quotes (single, double, or triple).
They support various operations such as concatenation and slicing.
For example:
product_name = "Smartphone"
product_price = 699
description = "The {} costs ${}"
formatted_description = description.format(product_name, product_price)
print(formatted_description)
Problems:
1. Determine whether a number is an Armstrong number.
2. Determine whether a number is Strong or Weak.
3. Check whether a string is a palindrome or not.
4. Perform Matrix Multiplication.
1. Implementation code: (To determine an Armstong Number)
Output:
2. Implementation code: (To determine a strong or weak number)
Output:
3. Implementation code: (To check a palindrome string)
Output:
4. Implementation code: (Multiplication of Matrix)
Output:
Conclusion:
During this lab, I delved into fundamental concepts of Python programming. Beginning with the
basics such as data types, variables, and basic operations, I progressed to exploring control flow
structures like conditionals and loops, essential for decision-making and task repetition.
Furthermore, I gained insight into functions, which facilitate the organization of code into
reusable blocks, enhancing code efficiency and structure.
Engaging in practical problem-solving exercises, I applied these foundational concepts to various
challenges, including palindrome checks, matrix operations, and more. This hands-on approach
solidified my understanding of Python programming, equipping me with the necessary skills to
confidently tackle diverse coding tasks.
Overall, this lab provided a robust foundation in Python programming, empowering me to
approach coding endeavors with competence and proficiency.