Question

In: Computer Science

Python has an established coding style, but the style is a suggestion, and although you can...

Python has an established coding style, but the style is a suggestion, and although you can style your code using different style choices, you are strongly encouraged to be consistent.

true or false

Solutions

Expert Solution

TRUE

Giving you the reasons why a code style need to be consistent.

A coding style is actually about consistency.

Consistency within one module or function is the most important.

However we may come across situations where we need to be incosistent.

->When applying the same consistent coding style would make the code less readable, even for someone who is used to read codes, you have to break the rules there.

Excluding these types of very rare cases, it is strongly advisable to stay consistent while even though you have the feasibility of using different style choices, this is because

1)Consistent code style makes it easy for people to understand how a program works.

2) When reading consistent code, one can form a certain number of assumptions and expectations about how the code works and hence it becomes easier and safer to make modifications to it.

3)If there is same coding style for two different codes, then one can make changes to it easily without effecting any other things in that particular code.

4) When a group of people are working on the same code, It makes easy for all the people in that group in understading and developing the code if they follow code consistency.


Related Solutions

Although mutations in the coding region of a genes can lead to changes in protein sequence...
Although mutations in the coding region of a genes can lead to changes in protein sequence (non-synonomous, nonsense, frameshift) there are plenty of mutations in non-coding regions within the genome that can alter how gene are expressed. In the scenarios below, please indicate what non-coding regions might contain a SNP (Single Nucleotide Polymorphism) mutation, and how this SNP mutation might lead to the given scenario: a. no transcription occurs for a particular gene b. Transcription occurs, but the mRNA is...
Using Python coding language (with or without Pandas and/or NumPy), 1. Can you define function sleep...
Using Python coding language (with or without Pandas and/or NumPy), 1. Can you define function sleep to tell whether the participant are of the ages through 18 to 60 and sleep less than 6 hours per day? 2. Develop codes to check whether the sleep function you defined can make correct judgement. Make sure you write comments or create informative vairable name so that I can understand how you check the sleep function. (Hints: You can create toy data/dataframe to...
This is Python coding question, and topic is loop Can anyone help me figuring these out?...
This is Python coding question, and topic is loop Can anyone help me figuring these out? (Please do not use build in function) Thanks. 1. Write a program that prints your name 100 times to the screen. 2. Write a program that takes a string s and an integer n as parameters and prints the string s a total of in n times(once per line) 3. Write a for loop that prints all the integers from 3141 to 5926, skipping...
Using python coding, test for convergence of an infinite sequence or series. keep the coding at...
Using python coding, test for convergence of an infinite sequence or series. keep the coding at beginner level please!
This is for python coding First of all, you need to know what Natural Numbers are....
This is for python coding First of all, you need to know what Natural Numbers are. They are the positive integers (whole numbers) 1, 2, 3, etc., and zero as well. For this project, there are TWO PORTIONS: PORTION 1: Write a program to find the SUM of the first n natural numbers the user wants to add. The program should first prompt the user for how many natural numbers are to be summed. The use for loop to do...
**Please write in Java, in a very simple/beginner coding style/language - thank you!** Directions: Given a...
**Please write in Java, in a very simple/beginner coding style/language - thank you!** Directions: Given a factorial n!. Find the sum of its digits, and the number of trailing zeros (ie: the number of zeros at the end of the factorial). Input: integer nn, a non-negative integer where n≤20n≤20 Output: integer xyxy, the concatenation of x and y, where x is the sum of the digits in n! and y is the number of the zeros in n!) Note, 0≤x,y0≤x,y....
Can you give me a suggestion for internal control measures to prevent similar incidents in the...
Can you give me a suggestion for internal control measures to prevent similar incidents in the future 1MDB (1Malaysia Development Berhad scandal)
This is an exercise to design and write a Python program in good programming style for...
This is an exercise to design and write a Python program in good programming style for a simulation of stock price over a period of 100 days. In this exercise, you are asked to simulate the stock price starting at $100.00 for 100 days with a daily fluctuation based on the Normal Distribution with mean = 0.0 & sigma = 0.0125. The program will show the daily stock price, the 7-day minimum, the 7-day maximum, the 7-day average, and the...
Although mergers & acquisitions are established corporate finance activity, the common knowledge is that a majority...
Although mergers & acquisitions are established corporate finance activity, the common knowledge is that a majority of them fail to achieve stated targets and therefore they actually destroy shareholders’ wealth than create it. Discuss the potential ways in which managers may reduce the failure risk and increase the chances of successful transactions.
PYTHON CODING: In this problem, we will figure out if two balls are colliding. We will...
PYTHON CODING: In this problem, we will figure out if two balls are colliding. We will think in 2D to simplify things, though 3D isn’t different conceptually. For calculating collision, we only care about a ball’s position in space, as well as its size. We can store a ball’s position with the (x, y) coordinates of its center point, and we can calculate its size if we know its radius. Thus, we represent a ball in 2D space as a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT