EK伊人寻

EK伊人寻的笔记

来自开始编程(0)

print("i love pizza")print("pizza"*20)print("yum"*40)print("i'm full.")

来自第二个 Python 程序(0)

import randomsecret = random.randint(1,100)guess = 0tries = 0print("a ha,i'm jack,i have a secret!")print("it is a number between 1 to 99,you have six times to guess,come on!")while guess != secret and tries < 6:    guess = int(input("a number:"))    if guess < secret:        print("too small")    elif guess > secret:        print("too big")    tries = tries + 1if guess == secret:    print("well done,you got it.")else:    print("you have no chance,next time.")    print("it is",secret) 

来自来自互联网的输入(0)

from urllib.request import urlopenimport sslssl._create_default_https_context = ssl._create_unverified_contextfile  = urlopen('heeps://www.huxiu.com/article/323011.html')message = file.read().decode(encoding="utf-8",errors="srrict")print(message)

来自通过 GUI 输入(0)

import easyguiflavor=easygui.buttonbox("你喜欢什么口味的冰激凌?",choices=["香草味","巧克力味","草莓味"])easygui.msgbox("你选择了"+flavor) import easyguinum=easygui.integerbox("你想填入什么数字?",title="输入整数",lowerbound=0,upperbound=1000)easygui.msgbox("你填写了"+str(num)) 

来自再看猜数游戏(0)

import random,easyguisecret = random.randint(1,99)guess = 0tries = 0easygui.msgbox("it a number between 1 to 99 ,you have 7 times to guess.")while guess != secret and tries < 7 :    guess = easygui.integerbox("a number you want :")    if not guess : break    if guess < secret :         easygui.msgbox(str(guess)+"too small,pig")    elif guess > secret :         easygui.msgbox(str(guess)+"too big,pig")    tries = tries + 1if guess == secret:    easygui.msgbox("well done,you get it")else :          easygui.msgbox("you have no chance,next time to play the  game !")

来自是不是有问题(0)

num1=float(input("Enter the first number;"))num2=float(input("Enter the second number;"))if  num1 < num2:    print(num1,"is less than",num2)if  num1 > num2:    print(num1,"is greater than",num2)if  num1 == num2:    print(num1,"is equal to",num2)if  num1 != num2:    print(num1,"is not equal to",num2) 

来自没有数字的计数(0)

 for cool_guy in ["Spongebob","Spiderman","Justin Timberlake","My Dad"]:    print(cool_guy,"is the coolest guy ever!") 

来自按步长计数(0)

for i in range(1,10,2):     print(i)

来自条件循环(0)

print("输入3继续循环,输入其他值退出循环。")someInput=input()while someInput=='3':    print("感谢你输入3")    print("输入3继续循环,输入其他值退出循环。")    someInput=input()print("你输入的不是3,退出循环。")