What is the function of {:-9} in python? [closed] - python-3.x

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
In the Python tutorial (https://docs.python.org/3.8/tutorial/inputoutput.html) they used {:-9}, and i cant figure out for the life of me what the -9 does?:
yes_votes = 42_572_654
no_votes = 43_132_495
percentage = yes_votes / (yes_votes + no_votes)
'{:-9} YES votes {:2.2%}'.format(yes_votes, percentage)
Output:
42572654 YES votes 49.67%

The :-9 value indicates padding. If you remove the - the effect will be the same.
However, according to the docs, the - indicates that a sign should be used only for negative numbers (this is the default behavior).
Example:
Replacing %+f, %-f, and % f and specifying a sign:
>>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always
'+3.140000; -3.140000'
>>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers
' 3.140000; -3.140000'
>>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:f}; {:f}'
'3.140000; -3.140000'
More on Python's Format Specification Mini-Language can be found here

Related

How to understand about the working of the comments feature of Google Docs? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 days ago.
Improve this question
I was thinking about how a particular word on a Google Doc get detected/tracked every time we open the doc, the word may have multiple entries but always the correct one is chosen every time.
Also about changing the position of the commented text (let's say from line 1 to last line) which also works properly.
How does that work? I am particularly interested in the detection/tracking and backend. Are any documentation/references available?
Went through some sites but they explained how to use Google Docs.

vimscript - get a string consisting of multiple copies of a single char [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
So, I would like to do something like let dummy_string = 'a' * 6 and get dummy_string to contain a aaaaaa string.
Use repeat(), see :help repeat() for details.
let dummy_string = repeat('a',6)
Related question in Vi and Vim, vimscript: how to repeat a string N times?

Adding seconds to string date in bash [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I have a variable string date like this
#!/bin/bash
timeString="Mar 15 09:27:26"
I want to add 10 second to this variable and I do not know how.
It might be a duplicate post, but I did not had the inspiration to find a simple answer.
Convert to seconds, add 10, convert back to date string:
date +"%a %d %H:%M:%S" --date=#$(($(date +%s --date="Mar 15 09:27:26") + 10))
Uses $((...)) arithmetic substitution and $(...) command substitution of bash, and format converting functions of GNU date. (Note: On Mac, date has a different format)

If C6/2 is less than .5, then E6 will be .5 otherwise the answer is C6/2 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I would like to have a formula to answer the following:
If C6/2 is less than .5, then E6 will be .5 otherwise the answer is C6/2.
I would go with the equivalent (but smaller) statement =IF(C6<1,.5,C6/2)
What you're doing has another name it's called the max function. =MAX(C6/2,.5) will produce the same result but is much easier to read.
How about =IF(C6/2<.5,.5,C6/2)? Place in E6.

Find sequences that does not match to a target sequence [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
An interesting question by Rnaer from Biostar:
I want to find unique dna/protein sequences of a given length (30nt, for example)
that does not match to any region of the C.elegans genome. Is there
any tool to do that?
NCBI provides an easy way to search DNA/Amino acid sequence databases that DO NOT match to a target organisms genome, yet match to other databases and sources.
Just use the exclude field in NCBI's BLASTn
Hope this was useful.

Resources