开发者

cshell: How do I produce a list of decimal numbers?

I want to produce a list of numbers from 1 to 5 incrementing by 0.25 at each step, like this:

1.0, 1.25, 1.5, ..., 4.5, 4.75, 5.0

Is this possible to do in csh? If so, h开发者_如何学Pythonow do I do it?

Thanks for the help.


You can use the seq command as:

seq 1 0.25 5

Ideone link

To display all the numbers in one line you can use the -s(separator) option of seq as:

seq -s' ' 1 0.25 5

Ideone Link

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜