1. IDLE是python的外壳
2. IDLE——File——New File——输入程序段
3. 快捷键:
Alt + N #上一条语句
F5 #运行程序段
4. dir(builtins) #查看所有内置函数
5. help(xxx) #查看具体的某个函数怎么用,例如:help(input)
6. python不允许if条件中赋值,例如if(c = 3)在python中会报错的(C语言中不会报错),正确使用:if(c == 3)
7. 练习程序1
temp = input('请猜测一个数字(在1—100之间):')
guess = int(temp)
if 1 <= guess <= 100:
print('小仙女')
print('游戏结束')
else:
print('丑八怪')
print('好啦,不猜了')
7. 练习程序2
print('................I love fish...................')
temp = input("Guess what number I'm thinking of: ")
guess = int(temp)
if guess == 5:
print("Congratulations on your guess!")
else:
print("Unfortunately, your guess is wrong! The number is 5.")
print("Game over")