python基礎課題開發小遊戲

2021-08-14 23:15:41 字數 915 閱讀 6175

'''

created on 2023年1月24日

@author: vision_txg

'''#匯入tkinter庫

from tkinter import *

import tkinter.******dialog as dl

import tkinter.messagebox as mb #資訊框

#tk()是tkinter自帶的建構函式,主函式的顯示框

root = tk()

#標籤 標籤的顯示框和標題

w = label(root,text = "lable title")

#自帶調節標籤大小

w.pack()

#進入畫面

mb.showinfo("welcome", "welcome to guess number game")

number = 66

while true:

#提供乙個給使用者輸入的對話方塊

guess = dl.askinteger("number", "what's you guess?")

if guess == number:

output = "bingo! you guessed it right"

mb.showinfo("hint:",output)

break

elif guess < number:

output = "no,the number is a higer than that"

mb.showinfo("hint:",output)

else:

output = "no,the number is a lower than that"

mb.showinfo("hint:",output)

AcWing演算法基礎課題集

包括排序 二分 高精度 字首和與差分 雙指標演算法 位運算 離散化 區間合併等內容。快速排序 acwing 785.快速排序 acwing 786.第k個數 歸併排序 acwing 787.歸併排序 acwing 788.逆序對的數量 二分acwing 789.數的範圍 acwing 790.數的三...

python開發課題 課題 初識Python

中小學資訊科技課時備課 課題 初識 python 教材分析 本課是python 教材的第一課。學生將從這裡開始接觸並學習 python 因此,教 材的內容設計淺顯易懂,主要是讓學生了解 python 的介面和如何使用 idle 青 學情分析 七年級部分學生在小學學習過 scratch 也有大部分學生...

python基礎 小遊戲簡單實現

給定年齡,使用者可以猜三次年齡 年齡猜對,讓使用者選擇兩次獎勵 使用者選擇兩次獎勵後可以退出 age 20 age count 0 while age count 3 age inp input 請輸入你猜測的年齡 if not age inp.isdigit print 請輸入你猜測的年齡的數字 ...