#此為注釋
"""
test
此為範圍註釋
"""
#9*9*9 乘法表
def multi():
for num1 in range(1,10):
for num2 in range(1,10):
for num3 in range(1,10):
print(num1,'*',num2,'*',num3,'=',num1*num2*num3,sep='')
#how to use while
def sample_while():
n = 0
while (n<100):
print(n)
n = n + 1
def sample_if():
num = (int)(input('enter a number:'))
if(num>0):
print('this number is positive number')
elif(num<0):
print('this number is negative number')
else:
print('this number is zero')
#use while and if
def sample_guessnumber():
answer = 76
guess = None
count = 0
print('guess a number,if you guess a right number,loop will berak.')
while(answer!=guess):
guess = int(input('guess a number:'))
count = count + 1
print('you guess',count,'time')
import math
def sample_w3():
直徑 = 1
# pi 與 e 屬於 math 模組(類別)屬性
轉動慣性矩 = math.pi*直徑**4/64
截面模數 = math.pi*直徑**3/32
迴轉半徑 = 直徑/4
截面積 = math.pi*(直徑/2)**2
print('轉動慣性矩:',轉動慣性矩)
print('截面模數:',截面模數)
print('截面積:',截面積)
# 利用 round() 取到小數點 3 位數
print('轉動慣性矩取到小數點第三位:',round(轉動慣性矩, 3))
def sample_w3_exten():
for 直徑 in range(1,10):
print('直徑:',直徑)
# pi 與 e 屬於 math 模組(類別)屬性
轉動慣性矩 = math.pi*直徑**4/64
截面模數 = math.pi*直徑**3/32
迴轉半徑 = 直徑/4
截面積 = math.pi*(直徑/2)**2
print('轉動慣性矩:',轉動慣性矩)
print('截面模數:',截面模數)
print('截面積:',截面積)
# 利用 round() 取到小數點 3 位數
print('轉動慣性矩(取到小數點第三位):',round(轉動慣性矩, 3))
sample_w3_exten()
2012年10月26日 星期五
101設計一甲_w6
2011年12月25日 星期日
100設計一甲_Merry Christmas
Merry Christmas tree.c
#include<stdio.h>
void triangel(int num){
int i,j,space=num-1,x;
for (i=1 ; i<=num ; i++,space--){
for(x=1;x<=space;x++)
printf(" ");
for (j=1 ; j<=(-1+2*i) ; j++)
printf("*");
printf("\n");
}
for(i=1;i<=num;i++){
for(x=1;x<=num-1;x++)
printf(" ");
printf("*\n");
}
for(i=1;i<=num-1-5;i++){
printf(" ");
}
printf("Merry Christmas!");
}
int main(void){
triangel(10);
return 0;
}
2011年12月20日 星期二
100設計一甲_week15
libw15.c
#include <stdio.h>
#include <stdlib.h>
int add(int a, int b, int c) {
return a+b+c;
}
double add2(double a, double b, double c) {
return a+b+c;
}
int mul(int a, int b, int c) {
return a*b*c;
}
ex1.py
#coding: utf-8
# 本程式透過 ctype 模組, 直接導入 dll 動態連結庫, 並使用其函式
from ctypes import cdll,c_int,c_double
lib = "libw15.dll"
dll = cdll.LoadLibrary(lib)
#add = (lambda x,y: dll.add(c_int(x), c_int(y)))
# 以上 lambda 函式定義與下列函式相同
def add(x,y,z):
return dll.add(c_int(x), c_int(y), c_int(z))
'''
ctypes 介面僅支援整數, 長整數與字串資料型別, 若使用(雙)浮點數或其他 ctype 所不支援的
資料型別, 則必須要明確告訴 ctypes 如何進行函式傳回值的轉換, 否則無法得到精確資料
'''
def add2(x,y,z):
return dll.add2(c_double(x), c_double(y), c_double(z))
# 指定 add2 函式的資料傳回型別為 c_double
dll.add2.restype = c_double
multiply = (lambda x,y,z: dll.mul(c_int(x), c_int(y), c_int(z)))
變數1 = 12
變數2 = 10
變數3 = 15
print ("變數1加上變數2加上變數3, 其值為:",add(變數1,變數2,變數3))
print ("變數1乘上變數2乘上變數3, 其值為:",multiply(變數1,變數2,變數3))
'''
15*12 = 15*2+15*10 = 150+30 = 180
15*12 = 15*2*6 = 180
'''
變數4 = 12.345
變數5 = 10.6
變數6 = 66.6
print ("變數4加上變數5加上變數6, 其值為:",add2(變數4,變數5,變數6))
123.c complier出來的dll重新命名為->sum.pyd
#include <Python.h>
int sum2(int a, int b, int c);
int sum2(int a, int b, int c){
return a+b+c;
}
static PyObject* mod_sum(PyObject *self, PyObject *args)
{
int a;
int b;
int c;
int s;
if (!PyArg_ParseTuple(args,"iii",&a,&b,&c))
return NULL;
s = sum2(a,b,c);
return Py_BuildValue("i",s);
}
static struct PyMethodDef Mod_Methods[] = {
{"sum", mod_sum, METH_VARARGS, "Description.."},
{NULL,NULL,0,NULL}
};
static struct PyModuleDef ModMethods = {
PyModuleDef_HEAD_INIT,
"SumModule",
"SumModule_doc",
-1,
Mod_Methods
};
PyMODINIT_FUNC
PyInit_sum(void)
{
(void) PyModule_Create(&ModMethods);
}
ex2.py
''' from sum import * print(sum(10,20)) ''' import sum print(sum.sum(10,20,30))w15.c
#include<stdio.h>
#define pi 3.14159
double circlearea(double r){
return r*r*pi;
}
int plus(int a,int b,int c){
return a*b-c;
}
float bmi(float heigh,float weight){
return weight/(heigh*heigh);
}
char *mystring(char str[]){
return str;
//printf("%s",str);
}
int main(void) {
printf("%e\n",circlearea(1.));
printf("%d\n",plus(1.5,6,5));
printf("%d\n",plus(1,6,5));
printf("%f\n",bmi(1.8,60));
printf("%s\n",mystring("asd"));
mystring("asd");
return 0;
}
2011年12月6日 星期二
100設計一甲_week13
#include<stdio.h>
void fun1(){
int i=0;
printf("while test1----\n");
while(i<15){
printf("%d\n",i);
i++;
}
i=15;
printf("while test2----\n");
while(i){
printf("%d\n",i);
i--;
}
printf("for test1----\n");
for(i=0;i<15;i++){
printf("%d\n",i);
}
}
int main(){
int num1 = 123;
float num2 = 3.14159;
double num3 = 3.14159e-3;
char name1[6] = {'h','e','l','l','o','\0'};
char name2[6] = "hello";
/*
字串最後必須加上結束\0字元,代表字串結束
hello 為五個字元 但最後必須加上\0,所以為六個字元。
*/
printf("%d\n", num1);
printf("%f\n", num2);
printf("%e\n", num3);
printf("%s\n", name1);
printf("%s\n", name2);
printf("%c\n", name1[1]);
printf("%c\n", name2[1]);
fun1();
return 0;
}
2011年11月29日 星期二
100設計一甲_week12 小考答案
exam1.c
#include<stdio.h>
void q1(){
int i;
int num1=0,num3=0;
int total=0;
for(i=399;i<=8993;i++){
num1=i%10;
num3=(i/100)%10;
if((num1+num3)==11){
total+=i;
}
}
printf("%d\n",total);
}
void q2(){
int i;
int num1=0,num3=0;
int total=0;
for(i=359;i<=8691;i++){
if(i%7==0 && i%2==0){
total+=i;
}
}
printf("%d\n",total);
}
void q3(){
int i;
int num1=0,num3=0;
int total=0;
for(i=95;i<=8505;i++){
if(i%14!=0){
total+=i;
}
}
printf("%d\n",total);
}
void q4(){
int i=0,j=0;
int total=0;
for(i=473;i<=8393;i++){
int count=0;
j=i;
while(j!=0 && count==0){
if(j%10==3||j%10==6||j%10==8)
count++;
j=j/10;
}
if(count!=0)
total+=i;
}
printf("%d\n",total);
}
void q5(){
int i;
int num1=0,num3=0;
int total=0;
for(i=486;i<=8817;i++){
num1=i%10;
num3=(i/100)%10;
if((num1*num3)==16)
total+=i;
}
printf("%d\n",total);
}
int main(){
q1();
q2();
q3();
q4();
q5();
return 0;
}
exam2.py
def q1():
total=0;
for i in range(399,8993+1):
num1=i%10;
num3=int(i/100)%10;
if((num1+num3)==11):
total+=i;
print(total)
def q2():
total=0
for i in range(359,8691+1):
if(i%7==0 and i%2==0):
total+=i
print(total)
def q3():
total=0
for i in range(95,8505+1):
if(i%14!=0):
total+=i
print(total)
def q4():
total=0
for 索引 in range(473,8393+1):
if str(索引).find("3") != -1 or str(索引).find("6") != -1 or str(索引).find("8") != -1:
total+=索引
print(total)
def q5():
total=0;
for i in range(486,8817+1):
num1=i%10;
num3=int(i/100)%10;
if((num1*num3)==16):
total+=i;
print(total)
q1()
q2()
q3()
q4()
q5()
100設計一甲_week12
example1.c
Python Module in C 動態教學(Save as...)
Python_module.7z
tcc_gnuplot3.7z
#include<stdio.h>
int main(){
int num1 = 123;
float num2 = 3.14159;
double num3 = 3.14159e-3;
char name1[6] = "hello";
char name2[6]={'h','e','l','l','o','\0'};
/*
字串最後必須加上結束\0字元,代表字串結束
hello 為五個字元 但最後必須加上\0,所以為六個字元。
*/
printf("%d\n", num1);
printf("%f\n", num2);
printf("%e\n", num3);
printf("%s\n", name1);
printf("%s\n", name2);
printf("%c\n", name1[1]);
printf("%c\n", name2[1]);
return 0;
}
Python Module in C 動態教學(Save as...)
Python_module.7z
tcc_gnuplot3.7z
2011年11月22日 星期二
100設計一甲_week11
example1.c
#include<stdio.h>
int main(){
printf("hello c!\n");
return 0;
}
example2.c
#include<stdio.h>
int main(){
printf("hello c!\n");
int i=0;
for(i=0;i<10;i++){
printf("%d\n",i);
}
return 0;
}
example3.c
#include<stdio.h>
int main(){
int i=0;
for(i=0;i<=100;i++){
if(i<=40){
printf("C score:%d\n",i);
}
else if(i<=70){
printf("B score:%d\n",i);
}
else{
printf("A score:%d\n",i);
}
}
return 0;
}
/*
班級從1到最後一號
假如號碼是偶數 後面請加even
假如號碼是奇數 後面請加odd
依次序印出
*/
2011年11月15日 星期二
100設計一甲_week10
tkinter.py
#coding: utf-8
from tkinter import *
# 導入所有的數學函式
from math import *
# 導入數學函式後, 圓周率為 pi
# deg 為角度轉為徑度的轉換因子
deg = pi/180.
frame=Frame()
frame.master.title("繪圖範例")
frame.pack()
canvas = Canvas(width=800, height=800, bg='white')
canvas.pack(expand=YES, fill=BOTH)
def plotline():
for i in range(0, 500, 50):
canvas.create_line(0, i, 500, i)
#canvas.create_line(i, 0, i, 500)
def polygon(r=100,cx=150,cy=150,offset=30):
for i in range(270,270+360,offset):
x0=cx+r*cos(i*deg)
y0=cy+r*sin(i*deg)
x1=cx+r*cos((i+offset)*deg)
y1=cy+r*sin((i+offset)*deg)
canvas.create_line(x0,y0,x1,y1)
def plot():
for i in range(0,600,30):
canvas.create_line(400-i,350-i, 500+i,350-i)
canvas.create_line(500+i,350-i, 500+i,450+i)
canvas.create_line(500+i,450+i, 400-i,450+i)
canvas.create_line(400-i,450+i, 400-i,350-i)
plotline()
polygon()
mainloop()
find.py
s="applenkajkljkhapplejgaa"
pos=0
count=0
while(1):
pos=s.find("apple",pos)
if(pos==-1):
break
pos=pos+1
count=count+1
print(count)
print(s.count("apple"))
2011年11月8日 星期二
100設計一甲_week7
#Q1
#輸入一字串10字元將字串內容中的英文,小轉大寫,其餘照常印出。
def q1():
string=input("輸入一字串10字元:")#輸入字串
for i in range (0,len(string)):#len()測量字串長度
#判斷字元是否在需轉換範圍內
if(ord('A')<=ord(string[i])<=ord('Z')):#ord 將字元轉ascii dec
print(chr(ord(string[i])+32),end="")#chr 將整數轉成字元
#其餘正常印出
else:
print(string[i],end="")
#Q2
#你拿到一個整數(4位數),卻忍不住想把每個位數都乘在一起。
def q2():
total=1
num=input("輸入數字 n:")
for i in range(0,len(num)):
total*=int(num[i])#轉成整數
print(total)
#Q3
#輸入身高(cm)體重(kg),求BMI值並依照其BMI值印出體重分級與BMI,BMI需印至小數第一位。
def q3():
weight=float(input("輸入體重(kg)"))
heigh=float(input("輸入身高(cm)"))/100 #cm轉m 除100
BMI=weight/(heigh*heigh)
if(BMI < 18.5): #判斷BMI之範圍
print("%.1f 體重過輕"%(BMI))
elif(18.5 <= BMI <24):
print("%.1f 正常範圍"%(BMI))
elif(24 <= BMI < 27):
print("%.1f 過 重"%(BMI))
elif(27 <= BMI < 30):
print("%.1f 輕度肥胖"%(BMI))
elif(30 <= BMI < 35):
print("%.1f 中度肥胖"%(BMI))
else:
print("%.1f 重度肥胖"%(BMI))
#Q4
#由1到100,印出其中只含有3,不含有4,6,9的數值。
def q4():
for 索引 in range(1,101):
if str(索引).find("3") != -1:
if str(索引).find("4") == -1 and str(索引).find("6") == -1 and str(索引).find("9") == -1:
#find()找尋字串中是否有符合的字元 如果沒有則為-1 有則為符合字元的位置,底下q4find()函式為測試find的使用例子。
print(索引)
#Q5
#平方公尺轉坪數,輸入幾平方公尺,輸出幾坪。
#公式:坪數 = 平方公尺 * 0.3025 (固定)
def q5():
平方公尺=float(input("輸入幾平方公尺:"))#輸入可能帶有小數,因此轉為浮點數。
print(平方公尺*0.3025)
def q4find():
for i in ["taiwan","people"]:
print(i.find("w"))
2011年10月29日 星期六
100設計一甲_week6_模擬考答案
#1.
def q1():
a=input("姓名")
b=input("學號")
c=input("班級")
print(a,b,c)
#2.
def q2():
i=1
while(i<301):
print(i)
i+=1
for i in range(1,301):
print(i)
#3.
def q3():
sum = 0
for i in range(1,301):
sum = sum + i
print(sum)
#4.
# -*- coding: utf-8 -*-
def q4():
name = input("Please enter a character string: ")
print("The string capitalized is ", end="")
for i in range(0,6):
dec = int(ord(name[i]))
newstr = chr(dec-32)
print(newstr,end="")
print()
#5.
def q5(R):
print(R*R*3.14159265)
2011年10月25日 星期二
100設計一甲_week6_模擬考
1.使用input()函式輸入三個變數值(姓名 學號 班級)並輸出(Hint : input使用)
2.使用while以及for 各自印出從1到300的各個整數
3.用迴圈,計算1~300的總合(Hint : for while方式不限)
4.輸入6個字元的字串(英文小寫)轉成大寫輸出( Hint : input(),ord(),chr() )
5.使用自訂函式,計算圓面積,輸入R(半徑),R必須為函式之引數,試求面積(Hint : 需使用自訂函式,pi = 3.14159265)
2.使用while以及for 各自印出從1到300的各個整數
3.用迴圈,計算1~300的總合(Hint : for while方式不限)
4.輸入6個字元的字串(英文小寫)轉成大寫輸出( Hint : input(),ord(),chr() )
5.使用自訂函式,計算圓面積,輸入R(半徑),R必須為函式之引數,試求面積(Hint : 需使用自訂函式,pi = 3.14159265)
2011年10月19日 星期三
100設計一甲_week5
#print()<---在python 3裡print是一個函數 所以必須加上括號 與之前python版本print不同
#input()<---輸入,輸入進來的型態為str
#str()<---將()內轉換成字串
def ex1():
yourname = input("Please input your English name:")
for i in range(0,4):
print(yourname[i]+" ASCII value is "+str(ord(yourname[i])))
#輸入4字元的字串
#ord()轉換()內字元所對應的ascii瑪
#chr()轉換()內數字所對應的字元<---須為int
def ex2():
var = input("Please enter a four character string:")
print("The string capitalized is ",end="")
for i in range(0,4):
print(chr(ord(var[i])-32),end="")
print()
#mpg mile per gallon
#求每一加侖所跑的里程
#輸入miledorve、gallon
#miledorve/gallon=每加侖所跑的miles
def ex3():
miledrove = float(input("Please enter the miles you drove:"))
gallons = float(input("Please enter the gallons \
of gas you put in the tank:"))
print("You got",str(miledrove/gallons),"mpg on that tank of gas.")
#美元與外國幣值稅換
#以美國為主所以要查美國相對於各國的匯率
#rate此函式中代表匯率
#結果應該是 所要稅換的錢幣*匯率
def ex4():
dollars = float(input("What is the amount of US \
Dollars you wish to convert? "))
rate = float(input("What is the current exchange \
rate (1~US Dollar equals what in the Foreign Currency)? "))
print("The amount in the Foreign Currency is $%.2f"%(dollars*rate))
#以list來做9*9乘法表
#必須清楚for迴圈內的動作,變數的變動
#了解如何存取list內的內容
def ex5():
N=list(range(1,10))#[1,2...9]
X=list(range(1,10))#[1,2...9]
for i in N:
for y in X:
print(i,"*",y,"=",i*y,end="\t")
print()
def ex6():
N=list(range(20,31))#[20,21,22...30]
X=list(range(20,31))#[20,21,22...30]
for i in N:
for y in X:
print("%3d * %3d =%4d"%(i,y,i*y),end="\t")
print()
#店員找錢
#使用while迴圈 應找的錢(change) dollars(各種錢幣) pay(應找的硬幣數)
#每一次迴圈 把當時所要找的錢除目前使用的硬幣 得到其商 就是這種硬幣要找的數量
#找完一次,必須要把找的錢與已給的錢(硬幣直*找的硬幣數量)相減
#迴圈直到要找的錢為0時,結束迴圈
def pay():
change=int(input("input how much you should pay:"))
dollars=[100,50,10,5,1]
pay=[0,0,0,0,0]
i=0
while(change!=0):
coin=change//dollars[i]
pay[i]=coin
change=change-coin*dollars[i]
i+=1
print(pay)
for num in range(0,5):
print("%3d : %d 張"%(dollars[num],pay[num]))
pay()
2011年10月11日 星期二
100設計一甲_week4
#有關進位
#98436145310十進位
#0123456789ABCDEF十六進位
#0101101010二進位
#print(0b01101100)
#print(hex(108))
#print(0x6c)
#print(bin(108))
#print(bin(108))
def eight_bit(mystr):
return (int(mystr[0])*2**7+int(mystr[1])*2**6+int(mystr[2])*2**5+
int(mystr[3])*2**4+int(mystr[4])*2**3+int(mystr[5])*2**2+int(mystr[6])*2**1+int(mystr[7])*2**0)
#print(eight_bit("01101100"))
#請編寫一個簡單的互動式程式, 程式列印出”請輸入您的姓名”後
#, 等待使用者輸入. 使用者輸入姓名 XXX 後, 程式列印出”XXX, 歡迎進入程式語言的世界”.
def ex0():
var=1010.2011
print("%20d %5.1f %s"%(var,var,var))
def ex1():
username=input("請輸入您的姓名:")
print(username,"歡迎進入程式語言的世界.")
#請配合練習 1.14 編寫一個能夠列印從 1 累加到 100 總和的程式.
def ex2():
total=0
for num in range(1,100+1):
total=total+num
print("The total is",total)
def ex2_1():
total=0
num=1
while (num<101):
total=total+num
num=num+1
print("The total is",total)
#請編寫一個能夠在列印 “請問由 1 累加到哪一個大於 1 的整數?”, 後讀取使用者輸入的整數,
#並列印出從 1 累加到”某整數”總和的程式.
def ex3():
usernum=int(input("請問由1累加到哪一個大於1的整數:"))
if (usernum<1):
print("不符合要求")
else:
total=0
for num in range (1,usernum+1):
total=total+num
print("1累加到",usernum,"總和:",total)
#請問如何在使用者需要退出累加程式之前, 可以”一直”輸入累加極限值, 並且進行數值的累加運算?
def ex1_19_1():
username=input("Please enter your name:")
if(username is not None):
for alphabet in username:
print(alphabet,"ASCII value is",ord(alphabet))
def ex1_19_2():
username=input("Please enter your name:")
print("The string capitalized is")
for alphabet in username:
num=ord(alphabet)-32
print(chr(num),end="")
print()
# Date NTD/USD
#2011-10-07 30.493
#example iPhone 4S 16GB 199美元
#匯率稅換 US->$
def usconvert():
dollar=float(input("What is the amount of US Dollars you wish to convert:"))
exchange=float(input("What is the current exchange rate:"))
print("The amount in the Foreign Currency is $",dollar*exchange)
#底下是有關1.8之問題
"""
#1.8Q4
print(eight_bit("01101100"))
#1.8Q5
print(hex(108))
#1.8Q6
print(bin(-62))
#1.8Q7
print(chr(62))
#print(hex(10))
"""
#呼叫匯率稅換函式usconvert()
#usconvert()
#有問題請在底下留言,謝謝...
2011年10月4日 星期二
100設計一甲_week3
import random
def NumericOperations(num1,num2):
print("num1=",num1,"num2=",num2)
print("num1+num2=",num1+num2)
print("num1-num2=",num1-num2)
print("num1*num2=",num1*num2)
print("num1/num2=",num1/num2)
print("num1//num2=",num1//num2)
#除法之商
print("num1%num2=",num1%num2)
#除法之餘數
print("num1**num2=",num1**num2)
#num1的num2次方
def 猜數字():
標準答案 = random.randint(1,100)
你猜的數字 = int(input("123:"))
猜測次數 = 1
while 標準答案 != 你猜的數字:
if 標準答案 < 你猜的數字:
print("太大了,再猜一次! 加油")
else:
print("太小了,再猜一次!加油")
你猜的數字 = int(input("請輸入您所猜的整數:"))
猜測次數 = 猜測次數+1
print("猜對了!總共猜了", 猜測次數, "次")
def triangle(base,high):
#area=base*high/2
return (base*high/2)
def tri(base,high):
h=(base*base+high*high)**0.5
print(h)
#return (h)
def squre(x,n):
ans=1
while(n>0):
ans=ans*x
n=n-1
return (ans)
print(squre(2,10))
#print(2**10)
def ex1(x,n):
ans=0
while x<=n:
ans=ans+x
x=x+1
return (ans)
print(ex1(1,100))
#1+2+3+...+99+100
#one day one apple
def apple():
ans="apple"
guess=""
count=0
while(ans!=guess and count<10):
print("一天一??,醫生遠離你,只能猜十次喔")
ans=input("ans:")
count=count+1
if(ans!=guess):
print("十次都沒答對.......")
else:
print("你答對了,猜了",count,"次,答案為一天一",ans,"醫生遠離你")
#apple()
print(triangle(3,4))
print(tri(3,4))
2011年9月27日 星期二
100設計一甲_week2
#請自行選用函式使用
#def
#if else
#ex1 num+mde 1~60 43 print None
def ex1():
for num in range(1,60):
if(num==43):
print("None")
else:
print("Number:",40023100+num,"Department of Mechanical Design Engineering")
#ex2 num+girl or boy 43no print
def ex2():
for num in range(1,60):
if(num!=43):
if(num<=10):
print("Number:",40023100+num,"girl")
else:
print("Number:",40023100+num,"boy")
#ex3 socre A(81~100)B(41~80)C(1~40)
def ex3():
for score in range(1,101):
if(score<=40):
print("Score:",score,"C")
elif(score>40 and score<=80):
print("Score:",score,"B")
else:
print("Score:",score,"A")
def myadd(var1, var2):
return (var1+var2)
def myfun():
print("Hello World!")
#ex4 funstory input bird(string)
def fun(bird):
print("有個小姐逛街走入一家店時,")
print("店門口有一隻",bird,"大聲的喊『歡迎光臨』。")
print("她覺得很好奇, 想試試看這隻",bird,"是不是真的這麼聰明,")
print("就又走了出去")
print("結果這隻",bird,"真的對她說『謝謝光臨。』")
print("她覺得很好玩,於是又走了進去,『歡迎光臨』。")
print("又走了出來『謝謝光臨』。")
print("她來來回回走了十幾次,")
print(bird,"也一直說『歡迎光臨』,『謝謝光臨』。")
print("於是她又走進去,")
print("這次這隻",bird,"不再理她,")
print("反而轉過頭去對著裡面大喊:『老闆,有人在玩你的鳥』。")
#可以直接印出回傳(return)值
print(myadd(1,2))
"""
#也可以將回傳值存在另一變數,之後將之印出
temp=myadd(1,2)
print(temp)
"""
myfun()
#fun("鸚鵡")
"""
英語小補帖(與課程無關,僅供參考)
1. You had me at hello.
0你一開口就征服我了
1你跟我說哈囉
2. Life will find its own way.
0我可以靠自己找路
1生命會自己找出口
3.Stupid is as stupid does.
0你是個笨蛋
1傻人有傻福
4. Destiny takes a hand.
0命中注定
1有錢能使鬼推磨
5. Am I reaching for the stars here?
0我是在強人所難嗎
1你很難追
6. I'll be back
0我會回來的
1我在你後面
answer:011000
"""
2011年9月20日 星期二
100設計一甲_week1
#coding: utf8
#--->代表註解,程式會跳過,繼續執行
#print()-->印出 ()內的
#ex1~6 使用,請自行削掉註解符號(#)
#ex1
print ("python!")
print ("WOW!~")
print ("python!","hello","WOW!",end="-->this is end!\n",sep="----")
###ex2
##print ("python!",end="")
##print ("WOW!~")
###ex3
##print ("python!","hello","WOW!",sep="----")
###ex4
##print ("python!","hello","WOW!",sep="----",end="-->this is end!\n")
###ex5
##for i in range (1,10):
## print ("hi","hello","python",sep="~")
###ex6
##for i in range (1,60):
## print ("Number:",40023100+i,"mde")
2011年9月16日 星期五
建立bat關閉Immunet 3.0服務
net stop "Immunet 3.0" /yes請將以上內容貼入記事本並且選擇存檔類型為"所有檔案"另存為『Stop Immunet 3.0.bat』
放在隨身碟點兩下即關閉該服務,
或是直接複製該串後,按下Windows+R貼上執行。
後記:
電腦教室的防毒軟體實在很拖速度,
要進入控制台>切換到傳統檢視>系統管理工具>服務>汪洋中找到Immunet 3.0
這麼一長串的內容實在是讓人懶得去記,
而且自己電腦通常也不是裝這套防毒軟體,
乾脆做成一個可以點兩下馬上關閉的執行檔不是很快樂嗎=w=
訂閱:
文章 (Atom)