28 Apr Coding Standard For Python Coding Assignments Sample
At Programming Homework Tutors, we believe in providing our students with practical, real-world examples of how to apply the concepts they learn in class. That’s why we’ve developed a variety of sample projects to help you see how our courses can be used to create impactful solutions in your field of study.
When you convert a design document (algorithm) into Python source code, one of your primary goals should be to write the source code and internal documentation in such a way so that it is easy to verify that the source code conforms to the design, and so that it is easy to debug, test, and maintain the source code. The coding standard below is designed to assist you in achieving this goal.
1. Source Code Format
Source code lines will be no more than 80 characters long. Break long lines into multiple shorter lines using the continuation character (“\”).
Only one statement will be included on a given line of the source code.
Use 4 spaces for indentation.
Blank lines and spaces will be used to enhance the readability of both source statements and comments.
All import statements will appear after the source code header and before any other Python code in the program.
All function definitions will appear after the import statements and before any other Python code in the program.
2. Source Code Header
Each source code file (including class files) will contain an introductory block of comments that identifies the assignment and gives a brief overview of the program. Note: Must fill-in the information in-between [ and]. For example:
###########################################################
# Assignment #: [ ]
# Author Name: [ ] VCCS Email: [ ]
# Assignment Description: [ ]
#
# Problem Algorithm:
Note: below is a sample algorithm. It must be replaced by the algorithm for the given problem in the assignment text.
# prompt for an integer
# input an integer
# loop while not end-of-data
# call function to count number of digits in integer
# output the number of digits
# prompt for an integer
# input an integer
# display closing message
###########################################################
3. Descriptive Comments
The source code will include comments that describe the functionality of significant blocks of code. Comments are particularly important before all blocks of code that perform major data manipulations or error processing.
For readability, each comment will be indented at the same level as the block of code that it describes or, if it fits within the 80-character limit and describes just a single line of code, to the right of that line.
Place comments to indicate:
The purpose of objects that are not clear from their names.
Where something is “tricky”, “clever”, or “unusual”; if it required thought on your part, it should be commented.
Note:
If it was hard to write, it is probably hard to read. Add a comment.
4. Mnemonic Identifiers
Meaningful identifiers taken from the problem domain will be used for all names. Furthermore, a name will be used for only one purpose (the same name will not be used for more than one purpose). Identifiers may be composed of multiple words. The assignment/program name must say/reflect what the assignment/program is doing/accomplishing. It should not contain your name, course name, assignment number…etc.
5. Symbolic Constants
Symbolic constants will be used instead of embedding arbitrary numeric and character constants in the source code. Use “upper with under” style for all symbolic constants:
HEAT_OF_FUSION = 79.71 # Calories to melt one gram of ice
6. Variable and Function Names
Use “lower with under” style for all variable and function names. In some situations, it is appropriate to append type information to variable names as a visual reminder about the purpose of those variables:
student_count = 0 # Number of students in class fahrenheit_float = 0.0 # Temperature in Fahrenheit
7. Function Header and Class Method Header
Using docstrings (delimited by triple double-quotes), each function will contain an introductory block of comments that: a. explains the purpose of the function and
describes all information passed to the function, modified by the function, and
returned by the function (parameters and global data objects).
It will also describe any assumptions about the information passed to the function that is needed for the function to work correctly.
Do the same for each class methods. For example:
def count_digits( value ):
“””
Function Description: Count the number of digits in an
integer value.
value: The value to be processed (int)
Returns: The number of digits in value (int)
“””
def add_assignment( grade_book, possible_pts ):
“””
Function Description: Adds a new assignment to a grade book. grade_book: the grade book (dict) maps assignment names (str) to grad dicts, where a grade dict maps student PIDS (str) to grades (float) grade_book is both read and modified possible_pts: the total points possible, must be positive
“””
8. Class Names
Use “CamelCase” style for all class names: “CamelCase” means the first character of each word must be capitalized. See examples:
class SalariedEmployee
class HourlyEmployee
Disclaimer
The sample projects provided on our website are intended to be used as a guide and reference for educational purposes only. While we have made every effort to ensure that the projects are accurate and up-to-date, we do not guarantee their accuracy or completeness. The projects should be used at your own discretion, and we are not responsible for any loss or damage that may result from their use.
At Programming Homework Tutors, we are dedicated to helping students and educators achieve their goals by providing them with the resources they need to succeed. Our website offers a variety of tools and resources that can help you with the project mentioned above.
Whether you need help with research, project management, or technical support, our team of experts is here to assist you every step of the way. We offer online courses, tutorials, and community forums where you can connect with other learners and get the support you need to succeed.
If you’re looking to take your skills to the next level and make an impact in your field, we invite you to explore our website and see how we can help you achieve your goals.
Latest Topic
-
Cloud-Native Technologies: Best Practices
20 April, 2024 -
Generative AI with Llama 3: Shaping the Future
15 April, 2024 -
Mastering Llama 3: The Ultimate Guide
10 April, 2024
Category
- Assignment Help
- Homework Help
- Programming
- Trending Topics
- C Programming Assignment Help
- Art, Interactive, And Robotics
- Networked Operating Systems Programming
- Knowledge Representation & Reasoning Assignment Help
- Digital Systems Assignment Help
- Computer Design Assignment Help
- Artificial Life And Digital Evolution
- Coding and Fundamentals: Working With Collections
- UML Online Assignment Help
- Prolog Online Assignment Help
- Natural Language Processing Assignment Help
- Julia Assignment Help
- Golang Assignment Help
- Design Implementation Of Network Protocols
- Computer Architecture Assignment Help
- Object-Oriented Languages And Environments
- Coding Early Object and Algorithms: Java Coding Fundamentals
- Deep Learning In Healthcare Assignment Help
- Geometric Deep Learning Assignment Help
- Models Of Computation Assignment Help
- Systems Performance And Concurrent Computing
- Advanced Security Assignment Help
- Typescript Assignment Help
- Computational Media Assignment Help
- Design And Analysis Of Algorithms
- Geometric Modelling Assignment Help
- JavaScript Assignment Help
- MySQL Online Assignment Help
- Programming Practicum Assignment Help
- Public Policy, Legal, And Ethical Issues In Computing, Privacy, And Security
- Computer Vision
- Advanced Complexity Theory Assignment Help
- Big Data Mining Assignment Help
- Parallel Computing And Distributed Computing
- Law And Computer Science Assignment Help
- Engineering Distributed Objects For Cloud Computing
- Building Secure Computer Systems Assignment Help
- Ada Assignment Help
- R Programming Assignment Help
- Oracle Online Assignment Help
- Languages And Automata Assignment Help
- Haskell Assignment Help
- Economics And Computation Assignment Help
- ActionScript Assignment Help
- Audio Programming Assignment Help
- Bash Assignment Help
- Computer Graphics Assignment Help
- Groovy Assignment Help
- Kotlin Assignment Help
- Object Oriented Languages And Environments
- COBOL ASSIGNMENT HELP
- Bayesian Statistical Probabilistic Programming
- Computer Network Assignment Help
- Django Assignment Help
- Lambda Calculus Assignment Help
- Operating System Assignment Help
- Computational Learning Theory
- Delphi Assignment Help
- Concurrent Algorithms And Data Structures Assignment Help
- Machine Learning Assignment Help
- Human Computer Interface Assignment Help
- Foundations Of Data Networking Assignment Help
- Continuous Mathematics Assignment Help
- Compiler Assignment Help
- Computational Biology Assignment Help
- PostgreSQL Online Assignment Help
- Lua Assignment Help
- Human Computer Interaction Assignment Help
- Ethics And Responsible Innovation Assignment Help
- Communication And Ethical Issues In Computing
- Computer Science
- Combinatorial Optimisation Assignment Help
- Ethical Computing In Practice
- HTML Homework Assignment Help
- Linear Algebra Assignment Help
- Perl Assignment Help
- Artificial Intelligence Assignment Help
- Uncategorized
- Ethics And Professionalism Assignment Help
- Human Augmentics Assignment Help
- Linux Assignment Help
- PHP Assignment Help
- Assembly Language Assignment Help
- Dart Assignment Help
- Complete Python Bootcamp From Zero To Hero In Python Corrected Version
- Swift Assignment Help
- Computational Complexity Assignment Help
- Probability And Computing Assignment Help
- MATLAB Programming For Engineers
- Introduction To Statistical Learning
- Database Systems Implementation Assignment Help
- Computational Game Theory Assignment Help
- Database Assignment Help
- Probabilistic Model Checking Assignment Help
- Mathematics For Computer Science And Philosophy
- Introduction To Formal Proof Assignment Help
- Creative Coding Assignment Help
- Foundations Of Self-Programming Agents Assignment Help
- Machine Organization Assignment Help
- Software Design Assignment Help
- Data Communication And Networking Assignment Help
- Computational Biology
- Data Structure Assignment Help
- Foundations Of Software Engineering Assignment Help
- Mathematical Foundations Of Computing
- Principles Of Programming Languages Assignment Help
- Software Engineering Capstone Assignment Help
- Algorithms and Data Structures Assignment Help
No Comments