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
Does anyone remember the old old old BASIC code for converting Fahrenheit to Celsius? I'd really appreciate it if someone would post the text.
Check out the following PDF, on page 40 (pdf page 57):
The code would be something like, for Level II BASIC:
10 INPUT "FAHRENHEIT: "; F
20 C = 5 * (F - 32) / 9
30 PRINT F; " FAHRENHEIT IS "; C; " CELSIUS"
40 GOTO 10
If you're using the Model I with Level I BASIC, or some other severely limited TRS-80, you may need something even simpler.
try following
INPUT "Enter Fahrenheit "; FAHR20 : PRINT "Celsius is ", (FAHR-32) * 5 / 9
Related
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?
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
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)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am trying to code something in Haskell and can't find a breakthrough. What I'm trying to do, is from GHCi input one pair of numbers, do some equations with them and print out results. Let say the input is (a,b). Equations could be as simple as c = b **2 + a **3 - sin b and d = a - b
The output should be (c,d). Is it possible to do it and how.
Here is a sample ghci session:
> a = 3
> b = 4
> (b**2 + a**3 - sin b, a - b)
(43.75680249530793,-1)
If this does not meet your needs, you will need to be more specific about your needs (preferably in a fresh question that refers to this one and explains why the new question is different from this one).
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 6 years ago.
Improve this question
What is the difference for shift right? I know ASL and LSL are the same but I don't know difference for ASR and LSR, I have tried searching but could not find a solid answer.
I can actually explain the difference between LSR and ASR:
LSR is a logical shift right. It will shift, and the top bits become 0. This is equivalent to divide an unsigned int by a power of 2.
ASR is arithmetical shift right. It will shift the number, taking into account if the number of positive or negative. It will actually shift, but top bits get the value of bit 31 (Instead of 0). This has the effect of dividing a signed integer by a power of 2.