MySQL機能優化之table_cache設置裝備擺設參數淺析。本站提示廣大學習愛好者:(MySQL機能優化之table_cache設置裝備擺設參數淺析)文章只能為提供參考,不一定能成為您想要的結果。以下是MySQL機能優化之table_cache設置裝備擺設參數淺析正文
本文實例講述了python完成的簡略猜數字游戲。分享給年夜家供年夜家參考。詳細以下:
給定一個1-99之間的數,讓用戶猜數字,當用戶猜錯時會提醒用戶猜的數字是過年夜照樣太小,曉得用戶猜對數字為止,猜對數字用的次數越少成就越好。
import random n = random.randint(1, 99) guess = int(raw_input("Enter an integer from 1 to 99: ")) while n != "guess": print if guess < n: print "guess is low" guess = int(raw_input("Enter an integer from 1 to 99: ")) elif guess > n: print "guess is high" guess = int(raw_input("Enter an integer from 1 to 99: ")) else: print "you guessed it!" break print
願望本文所述對年夜家的Python法式設計有所贊助。