- 博客(8)
- 收藏
- 关注
原创 python学习笔记06(读写文件)
读文件Created on Mon Feb 12 00:18:30 2018@author: myself"""f = open("data.txt") #打开文件data = f.read() #文件内容写入字符串dataprint(data) #输出字符串f.close() #关闭文件,释放资源runfile(...
2018-02-12 00:35:34
389
原创 python学习笔记05(字符串与list)
字符串与list一样可遍历、索引、切片、连接但不能通过索引更改字符# -*- coding: utf-8 -*-"""Created on Sun Feb 11 13:33:59 2018@author: myself"""word = "helloworld"for i in (word): #字符串的遍历 print(i)print(word[1]) ...
2018-02-11 13:44:21
213
原创 python学习笔记04(点球游戏)
from random import choicesorce_com = 0sorce_you = 0direction = ["left","center","right"] for i in range (5): print("===Round %d - You kick!===" %(i+1)) print("Choose one side to shoot:")...
2018-02-11 10:30:04
854
原创 python学习笔记04(游戏点球大战、list索引与切片)
from random import choiceprint("Please choose one side to shoot:")print("left,center,right")you = input()print("You kicked " + you)direction = ["left","center","right"]com = choice(directio
2018-02-10 22:57:42
694
原创 python学习笔记03
函数我们去餐厅吃饭,跟服务员点了菜,过了一会儿,服务员把做好的菜端上来。餐厅的厨房就可以看作是一个函数,我们点的菜单,就是给这个函数的参数;厨师在厨房里做菜的过程就是这个函数的执行过程;做好的菜是返回结果,返回到我们的餐桌上。def sayHello(): print("Hello world") #定义函数sayHellosayHello()sayHello()sayHello...
2018-02-10 00:30:57
441
原创 python学习笔记02(for、字符串、字符串格式化、for循环嵌套)
for循环for i in range(1, 101): print i表示从1开始,到101为止(不包括101),取其中所有的整数。for i in range(1, 101)就是说,把这些数,依次赋值给变量i。1~100求和:sum = 0for i in range(1,101): sum = i + sum print("i=") print(i) p...
2018-02-09 14:17:35
1028
原创 python笔记01
if 条件: 选择执行的语句while 条件: 选择执行的语句随机数random:from random import randintnum = randint(1,100)选取随机数num输入answer猜num的值:from random import randintnum = randint(1,100)print("Please give me a number")bi...
2018-02-08 23:53:35
159
原创 我的java学习笔01继承
先构造父类Employee.javapackage inheritance;import java.util.Date;import java.util.GregorianCalendar;public class Employee { private String name; private double salary; private Date hireDay; pu
2017-09-19 10:47:24
415
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人