in Education by
I am the Python newbie. I would like to make the code well commented. For example, in C I can naturally write a single-line comment for every term of an expression: int hello_world_length = 5 + // length of "Hello" 1 + // space between words 5; // length of "World" How can I write the same statement in Python? The code I have tried: hello_world_length = 5 + # length of "Hello" 1 + # space between words 5 # length of "World" hello_world_length = 5 + # length of "Hello" 1 + # space between words 5 # length of "World" hello_world_length = \ 5 + # length of "Hello" \ 1 + # space between words \ 5 # length of "World" Neither of the above works. I have read the Python tutorial but didn't find the solution. Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Just wrap the right-hand side in parens. 4-space indentation would be common: hello_world_length = ( 5 + # length of "Hello" 1 + # space between words 5 # length of "World" ) print(hello_world_length) 11 If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch

Related questions

0 votes
    The code works fine but the only problem I encountered an error is: bad operand type for unary +: 'str'. This is ... for unary +: 'str' Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me how do I start learning Python for Data Science? Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
    It is a principal question, regarding the theory of neural networks: Why do we have to normalize the input for ... is not normalized? Select the correct answer from above options...
asked Jan 27, 2022 in Education by JackTerrance
0 votes
    I want to save files for each result from the loop. For example, I wrote the code but it only saves one file ... do I modify my code? Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I am getting errors for the code when running it on a 'tips' dataset but I can run it on a tulips dataset ... . Am I missing something? Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me why Python is better than R for Data Science? Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me whether Python is necessary for Data Science? Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me whether Python is good for Data Science? Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I wrote the code for the counter in python, but I did not my appropriate result. I made the list by input numbers, ... like: [33,16,19] Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me whether Python is enough for Data Science? Select the correct answer from above options...
asked Jan 18, 2022 in Education by JackTerrance
0 votes
    Do I need coding skills for Data Science using Python? Select the correct answer from above options...
asked Jan 17, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me what should I learn in Python for Data Science? Select the correct answer from above options...
asked Jan 17, 2022 in Education by JackTerrance
0 votes
    I am trying to make an app that can get the patient's symptoms as inputs and outputs the three most likely ... classes[sortedshit[2]]) Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
    SA=1000.00 AI=0.12 MP=100.00 def remainb(x): if x==0: return 0 else: return x=(SA+(AI/12)*SA)-MP for ... . run the loop until SA==0). Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me where can I learn Python for Data Science? Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
...