1. 程式人生 > >程序執行流程/布爾類型與布爾:運算猜數字遊戲;

程序執行流程/布爾類型與布爾:運算猜數字遊戲;

imp color 布爾 red spa png code alt done

input(start)
myNumber = 7

while True:
    guess = int(input())
    if guess > myNumber:
        print(>)
    elif guess < myNumber:
        print (<)
    else:
        print(‘‘)
        break

技術分享圖片

import turtle
turtle.fillcolor(red)
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()

turtle.up()
turtle.goto(0,
-100) turtle.down() turtle.fillcolor(blue) turtle.begin_fill() turtle.circle(300) turtle.end_fill() turtle.down() turtle.goto(0,-50) turtle.down() turtle.fillcolor(red) turtle.begin_fill() turtle.circle(150) turtle.end_fill() turtle.circle(100) turtle.fillcolor(yellow) turtle.begin_fill() turtle.circle(
50) turtle.end_fill() turtle.done()

技術分享圖片

程序執行流程/布爾類型與布爾:運算猜數字遊戲;