MiaoDa


  • Home

  • Archives

  • Tags

金字塔、棱形打印

Posted on 2018-04-14

打印金字塔

这里只展示打印数字金字塔,答应 * 型金字塔更容易

Read more »

打印树形

Posted on 2018-04-14

```python n = int(input(‘输入树干的高度:’)) s = ‘*’

Read more »

佛主镇楼

Posted on 2018-04-13

佛主镇楼

print ("                            _ooOoo_  ")
print ("                           o8888888o  ")
print ("                           88  .  88  ")
print ("                           (| -_- |)  ")
print ("                            O\\ = /O  ")
print ("                        ____/`---'\\____  ")
print ("                      .   ' \\| |// `.  ")
print ("                       / \\||| : |||// \\  ")
print ("                     / _||||| -:- |||||- \\  ")
print ("                       | | \\\\\\ - /// | |  ")
print ("                     | \\_| ''\\---/'' | |  ")
print ("                      \\ .-\\__ `-` ___/-. /  ")
print ("                   ___`. .' /--.--\\ `. . __  ")
print ("                ."" '< `.___\\_<|>_/___.' >'"".  ")
print ("               | | : `- \\`.;`\\ _ /`;.`/ - ` : | |  ")
print ("                 \\ \\ `-. \\_ __\\ /__ _/ .-` / /  ")
print ("         ======`-.____`-.___\\_____/___.-`____.-'======  ")
print ("                            `=---='  ")
print ()
print ("         .............................................  ")
print ("                  程序人员写程序,又拿程序换酒钱。  ")
print ("                  酒醒只在网上坐,酒醉还来网下眠;  ")
print ("                  酒醉酒醒日复日,网上网下年复年。  ")
print ("                  但愿老死电脑间,不愿鞠躬老板前;  ")
print ("                  奔驰宝马贵者趣,公交自行程序员。  ")
print ("                  别人笑我忒疯癫,我笑自己命太贱;  ")
print ("                  不见满街漂亮妹,哪个归得程序员?")
Read more »

质数

Posted on 2018-04-11

质数

```python ‘’’

isPrimes()判断一个数是不是质数

’’’ def isPrimes(n): for i in range(2,n): if n%i == 0: return False break else: return True

Read more »

斐波那契数列

Posted on 2018-04-10

```python while True: n = int(input(‘输入打印的个数:’)) a, b = 1, 1 for _ in range(1, n+1): print(a, end=’ ‘) a, b = b, a+b print(‘\n’)

Read more »

字符串常见操作

Posted on 2018-04-10

```python while True: s.isdigit() #判断是不是数字 s.isalpha() #判断是不是字母 s.islower() #判断是不是小写 s.isupper() #判断是不是大写 s.isspace() #判断是不是空格 s.center(width[,fill]) #字符串居中 s.count(sub[,start[,end]]) #统计字符个数 s.strip() #去除首尾空格 s.lstrip() #去除左空格 s.rstrip() #去除右空格 s.find(sub[,start[,end]]) #字符查找

Read more »

Python闰年

Posted on 2018-04-10

r()判断闰年

def r(n):
    if n%4 == 0 and n%100 != 0 or n%400 == 0:
        return True
    else:
        return False
Read more »

当网页内容小于屏幕高度时生成DIV将footer固定到底部

Posted on 2018-03-17

如果一个网页的内容很少,就是<body> 的高度小于屏幕的高度,那么 <footer> 就不在屏幕最下方。 在 <footer> 上方添加一个 <div id="push-to-bottom"></div> 将 <footer> 挤到屏幕最下方

Read more »

滚动固定侧边栏

Posted on 2018-03-17

根据屏幕高度、滚动高度、侧边栏自身高度判断,具体实现看代码,知道思路就好了

实现代码

var jWindow = $(window);
jWindow.scroll(function(){
	var scrollheight = jWindow.scrollTop();
	var screenHeight = jWindow.height();
	var sideheight = $('#j_BdSide').height();
	if(scrollHeight + screenHeight > sideheight){
		$('#j_BdSide').css({
			'position' : 'fixed',
			'top' : '-(sideheight - screenHeight)',
			'right' : 0
		});
	}else{
		$('#J_BdSide').css({
			'position' : 'static'
		});
	}
});
//当页面加载的时候触发一次滚动
window.onload = function(){
	jWindow.trigger('scroll');
};
//当窗口尺寸发生变化的时候触发滚动
jWindow.resize = function(){
	jWindow.trigger('scroll');
};
Read more »

在Jekyll中使用代码高亮

Posted on 2018-02-25

将代码块放在 ''' 代码块 ''' 中如下图

Read more »
1 2 3
MiaoDa

MiaoDa

blog

25 posts
6 categories
9 tags
RSS
© 2018 MiaoDa
Powered by Jekyll
Theme - NexT.Mist