├── 01code.py ├── 02variables.py ├── 03data_data_types.py ├── 04input_function.py ├── 05dynamic_vs_static_prog_lang.py ├── 06concatenation.py ├── 07strings.py ├── 08arithmetic_operations.py ├── 09comparison_operators.py ├── 10conditional_statement.py ├── 11boolean_operators.py ├── 12python_list.py ├── 13python_tuple.py ├── 14python_set.py ├── 15python_dictionary.py ├── 16loop.py ├── 17python_function.py ├── 18python_class.py ├── 19studentMIS.py ├── 20python_modules.py ├── 21python_libraries.py ├── 22extra.py ├── README.md ├── book.pdf └── keyPoints.txt /01code.py: -------------------------------------------------------------------------------- 1 | # My First Python Program 2 | # Comments 3 | # Comments are non-executable notes written to give some descriptive information on the kind of programming logic being implemented 4 | ''' 5 | This can also be used as a comment; 6 | ''' 7 | """ 8 | However, it has a more usefule purpose we will discuss later 9 | """ 10 | 11 | 12 | # print parameters 13 | 14 | 15 | # Python language order of execution 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /02variables.py: -------------------------------------------------------------------------------- 1 | # A variable is a placeholder for storing data in the computer memory 2 | 3 | 4 | # VARIABLE NAMING RULES 5 | # 1. Use descriptive names 6 | # 2. Cannot use white spaces and hyphen in between names 7 | # 3. Use underscore 8 | # 4. Use camelCase notation 9 | # 5. Cannot start with a number but can have a number in it 10 | # 6. Cannot use reserved keywords 11 | # 7. Python is case-sensitive 12 | 13 | 14 | # Multiple Assignment or Unpacking 15 | -------------------------------------------------------------------------------- /03data_data_types.py: -------------------------------------------------------------------------------- 1 | # Data is the value stored inside a variable. 2 | 3 | # String -- str 4 | # String is a collection of characters declared within a single or double quotation mark 5 | 6 | 7 | # Integer -- int 8 | # Integer is a positive or negative whole number 9 | 10 | 11 | # Float -- float 12 | # A float is a fractional or decimal value 13 | 14 | 15 | # Complex -- complex 16 | # A complex number is a number which consist of a real part and an imaginary part. 17 | 18 | 19 | # Boolean -- bool 20 | # A boolean data type represents data that can only exist in two forms. 21 | -------------------------------------------------------------------------------- /04input_function.py: -------------------------------------------------------------------------------- 1 | # Python input function 2 | -------------------------------------------------------------------------------- /05dynamic_vs_static_prog_lang.py: -------------------------------------------------------------------------------- 1 | # Characteristics of Python programming language 2 | # Dynamic vs Static Programming Languages 3 | # Interpreted vs Compiled languages 4 | # High level vs Low level languages 5 | -------------------------------------------------------------------------------- /06concatenation.py: -------------------------------------------------------------------------------- 1 | # Python concatenation 2 | # This simply means joining two or more string values together 3 | 4 | 5 | # Formatted String 6 | -------------------------------------------------------------------------------- /07strings.py: -------------------------------------------------------------------------------- 1 | # Python string and methods 2 | 3 | # When to use single or double quotation marks 4 | 5 | # Indexing: Python indexing starts from 0 6 | 7 | # len function 8 | 9 | # STRING METHODS 10 | 11 | # Capitalize -- Converts the first character to uppercase 12 | 13 | # Count -- Returns the number of times a specified character occurs in a string 14 | 15 | # Find -- Searches the string for a specified value and returns the position (index) of where it was found 16 | 17 | # Replace -- Replaces a specified value with another 18 | 19 | # Index -- Searches the string for a specified value and returns the position of where it was found 20 | 21 | # Lower -- Converts a string into lower case 22 | 23 | # Upper -- Converts a string into upper case 24 | 25 | # Isalnum -- Returns True if all characters in the string are alphanumeric 26 | 27 | # Isdigit -- Returns True if all characters in the string are digits 28 | 29 | # Isspace -- Returns True if all characters in the string are whitespaces 30 | 31 | # Slipt -- Splits the string at the specified separator, and returns a list 32 | 33 | # Startwith -- Returns true if the string starts with the specified value 34 | 35 | # Endwith -- Returns true if the string ends with the specified value 36 | 37 | -------------------------------------------------------------------------------- /08arithmetic_operations.py: -------------------------------------------------------------------------------- 1 | # Python arithmetic operations + - * / // % ** 2 | 3 | # Addition + 4 | 5 | # Subtraction - 6 | 7 | # Multiplication * 8 | 9 | # Division / 10 | 11 | # Floor Division // 12 | 13 | # Power ** 14 | 15 | # Modulus % 16 | 17 | # Order of precedence-> (BODMAS) 18 | 19 | # Math functions 20 | 21 | # round 22 | 23 | # absolute value 24 | -------------------------------------------------------------------------------- /09comparison_operators.py: -------------------------------------------------------------------------------- 1 | # Python comparison operators # == < > <= >= != 2 | # Comparison operators are used to compare two or more values 3 | 4 | # Equal to == 5 | 6 | # Not Equal to != 7 | 8 | # Greater than > 9 | 10 | # Less than < 11 | 12 | # Grater than or equal to >= 13 | 14 | # Less than or equal to <= 15 | 16 | # Assignment Operator: = += -= *= 17 | -------------------------------------------------------------------------------- /10conditional_statement.py: -------------------------------------------------------------------------------- 1 | # Python conditional statement if else elif 2 | 3 | 4 | # EXERCISE 5 | 6 | # Program takes two inputs and checks which of the inputs is greater 7 | 8 | # Check Odd or Even numbers 9 | 10 | # Grade check results: 11 | # User input score and grade displays in the terminal 12 | -------------------------------------------------------------------------------- /11boolean_operators.py: -------------------------------------------------------------------------------- 1 | # Python logical operators [ and or not] 2 | # Boolean operators are used to combine conditional statements 3 | 4 | 5 | # and 6 | 7 | # or 8 | 9 | # not 10 | -------------------------------------------------------------------------------- /12python_list.py: -------------------------------------------------------------------------------- 1 | # Python list is a collection which is ordered and mutable. 2 | # It allows duplicate members 3 | 4 | 5 | # len fucntion 6 | 7 | # LIST METHODS 8 | # Append -- Adds an element at the end of the list 9 | 10 | # Clear -- Removes all the elements from the list 11 | 12 | # Copy -- Returns a copy of the list 13 | 14 | # Count -- Returns the number of elements with the specified value 15 | 16 | # Index -- Returns the index of the first element with the specified value 17 | 18 | # Sort -- Sorts the list 19 | 20 | # Reverse -- Reverses the order of the list 21 | 22 | # Remove -- Removes the first item with the specified value 23 | 24 | # Pop -- Removes the element at the specified position 25 | -------------------------------------------------------------------------------- /13python_tuple.py: -------------------------------------------------------------------------------- 1 | # Python tuple is a collection which is ordered. 2 | # A tuple is not mutable 3 | # It allows duplicate members 4 | 5 | 6 | # Unpack Tuple 7 | -------------------------------------------------------------------------------- /14python_set.py: -------------------------------------------------------------------------------- 1 | # Python set is a collection which is unordered and not mutable. 2 | # It does not allow duplicate members 3 | 4 | 5 | # Union and Intersection 6 | 7 | 8 | # Difference 9 | -------------------------------------------------------------------------------- /15python_dictionary.py: -------------------------------------------------------------------------------- 1 | # Python dictionary is a collection of key value pair of data. 2 | # It is ordered and mutable. 3 | # It allows duplicate members 4 | 5 | # Dictionary Methods 6 | 7 | # Copy -- Returns a copy of the dictionary 8 | 9 | # Clear -- Removes all the elements from the dictionary 10 | 11 | # Pop -- Removes the element with the specified key 12 | 13 | # Keys -- Returns a list containing the dictionary's keys 14 | 15 | # Values -- Returns a list containing the dictionary's values 16 | -------------------------------------------------------------------------------- /16loop.py: -------------------------------------------------------------------------------- 1 | # Loop 2 | # For loop 3 | 4 | # While loop 5 | 6 | # Loop through List 7 | 8 | # Loop through multiple Lists simultaneously using zip nethod 9 | 10 | 11 | # range method and loops 12 | 13 | 14 | # Loop through Dictionary 15 | 16 | # Exercise 17 | # 1. Find all the even numbers in a range 18 | # 2. Find the sum of all elements in a list 19 | -------------------------------------------------------------------------------- /17python_function.py: -------------------------------------------------------------------------------- 1 | # A function is a block of reusable code 2 | # Place a parenthesis() in front of the function name to call / invoke it 3 | 4 | # Parameters vs Argument 5 | # A parameter is the variable listed inside the parentheses in the function definition. 6 | # An argument is the value that is sent to the function when it is called. 7 | 8 | 9 | # Functions with Parameters and Argument 10 | 11 | 12 | # Important to be mindful of indentation 13 | 14 | 15 | # *args and **kwargs 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /18python_class.py: -------------------------------------------------------------------------------- 1 | # A class is a blue-print for creating objects. 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /19studentMIS.py: -------------------------------------------------------------------------------- 1 | # A class is a blue-print for creating objects. 2 | # In this code implementation of OOP in Python, 3 | # we shall implement an object-oriented database for the UG Student MIS 4 | 5 | 6 | # SECTION ONE 7 | # 1. Define a class for Person 8 | # 2. Create a person object from the Person class 9 | # 3. Use the constructor method to define attribute for the Person class 10 | # 4. Write a full_name method that returns the full name of the object 11 | 12 | 13 | # SECTION TWO 14 | # 1. Define a class Student which inherites from the Person class 15 | # 2. Define extra attributes for student, such as hall of residence and courses 16 | # 3. Create a student object from the Student class 17 | 18 | """ 19 | 4. Write a add_course, drop_course, print_all_courses method to mimic 20 | a real-world use-case of activities of adding a course, 21 | deleting a course and printing registered courses respectively 22 | a student will perform on the Student MIS 23 | 24 | """ 25 | 26 | # Magic Methods 27 | # Overwrite string method -------------------------------------------------------------------------------- /20python_modules.py: -------------------------------------------------------------------------------- 1 | # A python module is a piece of code/file that is imported and used in another python file 2 | # Inbuilt modules 3 | 4 | 5 | # Custome modules 6 | -------------------------------------------------------------------------------- /21python_libraries.py: -------------------------------------------------------------------------------- 1 | # Python Libraries 2 | 3 | 4 | # Python libraries are published onto the official python package index [https://pypi.org/] 5 | 6 | # kbtcal 7 | 8 | # QRCode Application 9 | 10 | # folium 11 | 12 | # pyttsx3 13 | 14 | # Build an AudioBook in Python 15 | 16 | # PySimpleGui 17 | 18 | # Flask 19 | 20 | # Django 21 | 22 | # NumPy 23 | 24 | # Pandas 25 | 26 | # Matplotlib 27 | -------------------------------------------------------------------------------- /22extra.py: -------------------------------------------------------------------------------- 1 | # Exception Handling 2 | 3 | 4 | # Environment Variables 5 | 6 | 7 | # Virtual Environment in Python 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SENG207-PROGRAMMING-FOR-ENGINEERS-MATERIALS 2 | 3 | 4 | - #### SENG 207 – Programming for Engineers is intended to introduce the fundamental concepts in computer programming to undergraduate engineering students. 5 | 6 | - #### Students will be introduced to Python Programming with specific focus in deepening their problem-solving skills using both structured and object-oriented programming approaches. 7 | 8 | - #### The labs and exercises are designed to enhance the students’ skills in creating complete programs to solve engineering, and other real-world problems. 9 | 10 | # The objectives: 11 | - #### To deepen students understanding in structured programming whiles introducing them to the fundamentals of computer programming. 12 | 13 | - #### To give hands on training to students in order to develop their skill in using programming to solve engineering and other real world problems. 14 | 15 | # Course Projects 16 | 17 |

The course projects for SENG207 Programming for Engineers are shown in the table below:

18 | 19 | |Project|Title|Comment| 20 | |----|----|----| 21 | |1 |Console Applications |Implementation of Python collections, arithmetic operations, and functions| 22 | |2|Unit Convertor Desktop Application|Implementation of logical controls and use of modules and libraries| 23 | |3|Desktop Text Editor Application|Implementation of logical controls and use of modules and libraries| 24 | |4|Simple Web Application|Implementation of OOP and programming logic for CRUD| 25 | |5|Data Analytics Project|Data analysis, data visualization, data inferences using data analytic libraries| 26 | 27 | # Course Assessment 28 | 29 |

SENG207 Programming for Engineers will be assessed using the following structure

30 | 31 | |Continuous Assessment | 60% | 32 | | ---- | :----| 33 | |Class attendance | 5% | 34 | |Class assignments (weekly) | 10% | 35 | |Quizzes (3 quizzes) | 15% | 36 | |Laboratory work | 15% | 37 | |Course project | 15% | 38 | |Online course | Maximum 10 extra marks | 39 | | | | 40 | |Final Exam | 40% | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /book.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KenBroTech/SENG207-PROGRAMMING-FOR-ENGINEERS-MATERIALS/87ee09bf48ea16dfb2396e3441d1c1bb7e557bc5/book.pdf -------------------------------------------------------------------------------- /keyPoints.txt: -------------------------------------------------------------------------------- 1 | 1. Running a python file 2 | python filename.py 3 | 4 | 2. Declaration of variables 5 | 6 | 3. Unpacking 7 | 8 | 4. Functions 9 | 10 | 5. Classes and Class Inheritance 11 | 12 | 6. Overwrite string method in Classes 13 | 14 | 7. Files Systems and Modules --------------------------------------------------------------------------------