国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

用python寫的新年快樂的代碼,python節(jié)日祝福源代碼

這篇具有很好參考價(jià)值的文章主要介紹了用python寫的新年快樂的代碼,python節(jié)日祝福源代碼。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

這篇文章主要介紹了用python寫的新年快樂的代碼,具有一定借鑒價(jià)值,需要的朋友可以參考下。希望大家閱讀完這篇文章后大有收獲,下面讓小編帶著大家一起了解一下。

python新年快樂代碼,pygame,python,開發(fā)語言,servlet

import os

import time

import random

import pygame

import colorama

‘‘‘一些變量‘‘‘

BGMPATH = ‘bgm.mp3‘

colorama.init(convert=True)

STARS = [2, 4, 8, 10, 14, 20, 26, 28, 40, 44, 52, 60, 64, 76]

HEARTS = [13, 27, 41, 55, 69, 77]

FLOWERS = [7, 15, 23, 31, 39, 46]

RED = colorama.Fore.RED + colorama.Style.BRIGHT

CYAN = colorama.Fore.CYAN + colorama.Style.BRIGHT

GREEN = colorama.Fore.GREEN + colorama.Style.BRIGHT

YELLOW = colorama.Fore.YELLOW + colorama.Style.BRIGHT

MAGENTA = colorama.Fore.MAGENTA + colorama.Style.BRIGHT

‘‘‘程序背景音樂‘‘‘

# def playBGM(bgm_path):

# pygame.mixer.init()

# pygame.mixer.music.load(bgm_path)

# pygame.mixer.music.play(-1)

‘‘‘換行‘‘‘

def nextLine():

time.sleep(0.3)

print()

‘‘‘畫心‘‘‘

def drawHeart():

num_spaces = random.randint(8, 80)

print(‘ ‘ * num_spaces, end=‘‘)

for i in range(78):

if i in HEARTS:

nextLine()

print(‘ ‘ * num_spaces, end=‘‘)

elif i in STARS:

print(RED + ‘*‘, end=‘‘)

elif i in [31, 35]:

print(GREEN + ‘2‘, end=‘‘)

elif i in [33, 37]:

print(GREEN + ‘0‘, end=‘‘)

else:

print(‘ ‘, end=‘‘)

‘‘‘顯示祝福文字‘‘‘

def showText():

print(‘ ‘ * random.randint(8, 80), end=‘‘)

print(CYAN + "Happy new year!", end=‘‘)

‘‘‘畫花‘‘‘

def drawFlower():

num_spaces = random.randint(8, 80)

print(‘ ‘ * num_spaces, end=‘‘)

for i in range(47):

if i in FLOWERS:

nextLine()

print(‘ ‘ * num_spaces, end=‘‘)

elif i in [2, 8, 12, 18]:

print(MAGENTA + ‘{‘, end=‘‘)

elif i in [3, 9, 13, 19]:

print(MAGENTA + ‘_‘, end=‘‘)

elif i in [4, 10, 14, 20]:

print(MAGENTA + ‘}‘, end=‘‘)

elif i in [27, 35, 43]:

print(GREEN + ‘|‘, end=‘‘)

elif i in [34, 44]:

print(GREEN + ‘~‘, end=‘‘)

elif i == 11:

print(YELLOW + ‘o‘, end=‘‘)

else:

print(‘ ‘, end=‘‘)

‘‘‘清屏‘‘‘

def clearScreen():

try:

os.system(‘cls‘)

except:

os.system(‘clear‘)

‘‘‘主程序‘‘‘

def main():

# playBGM(BGMPATH)

clearScreen()

while True:

drawHeart()

nextLine()

showText()

nextLine()

nextLine()

drawFlower()

print()

if __name__ == ‘__main__‘:

main()

原文:https://www.cnblogs.com/walkwaters/p/12128016.html文章來源地址http://www.zghlxwxcb.cn/news/detail-771243.html

import os

import time

import random

import pygame

import colorama

‘‘‘一些變量‘‘‘

BGMPATH = ‘bgm.mp3‘

colorama.init(convert=True)

STARS = [2, 4, 8, 10, 14, 20, 26, 28, 40, 44, 52, 60, 64, 76]

HEARTS = [13, 27, 41, 55, 69, 77]

FLOWERS = [7, 15, 23, 31, 39, 46]

RED = colorama.Fore.RED + colorama.Style.BRIGHT

CYAN = colorama.Fore.CYAN + colorama.Style.BRIGHT

GREEN = colorama.Fore.GREEN + colorama.Style.BRIGHT

YELLOW = colorama.Fore.YELLOW + colorama.Style.BRIGHT

MAGENTA = colorama.Fore.MAGENTA + colorama.Style.BRIGHT

‘‘‘程序背景音樂‘‘‘

# def playBGM(bgm_path):

# pygame.mixer.init()

# pygame.mixer.music.load(bgm_path)

# pygame.mixer.music.play(-1)

‘‘‘換行‘‘‘

def nextLine():

time.sleep(0.3)

print()

‘‘‘畫心‘‘‘

def drawHeart():

num_spaces = random.randint(8, 80)

print(‘ ‘ * num_spaces, end=‘‘)

for i in range(78):

if i in HEARTS:

nextLine()

print(‘ ‘ * num_spaces, end=‘‘)

elif i in STARS:

print(RED + ‘*‘, end=‘‘)

elif i in [31, 35]:

print(GREEN + ‘2‘, end=‘‘)

elif i in [33, 37]:

print(GREEN + ‘0‘, end=‘‘)

else:

print(‘ ‘, end=‘‘)

‘‘‘顯示祝福文字‘‘‘

def showText():

print(‘ ‘ * random.randint(8, 80), end=‘‘)

print(CYAN + "Happy new year!", end=‘‘)

‘‘‘畫花‘‘‘

def drawFlower():

num_spaces = random.randint(8, 80)

print(‘ ‘ * num_spaces, end=‘‘)

for i in range(47):

if i in FLOWERS:

nextLine()

print(‘ ‘ * num_spaces, end=‘‘)

elif i in [2, 8, 12, 18]:

print(MAGENTA + ‘{‘, end=‘‘)

elif i in [3, 9, 13, 19]:

print(MAGENTA + ‘_‘, end=‘‘)

elif i in [4, 10, 14, 20]:

print(MAGENTA + ‘}‘, end=‘‘)

elif i in [27, 35, 43]:

print(GREEN + ‘|‘, end=‘‘)

elif i in [34, 44]:

print(GREEN + ‘~‘, end=‘‘)

elif i == 11:

print(YELLOW + ‘o‘, end=‘‘)

else:

print(‘ ‘, end=‘‘)

‘‘‘清屏‘‘‘

def clearScreen():

try:

os.system(‘cls‘)

except:

os.system(‘clear‘)

‘‘‘主程序‘‘‘

def main():

# playBGM(BGMPATH)

clearScreen()

while True:

drawHeart()

nextLine()

showText()

nextLine()

nextLine()

drawFlower()

print()

if __name__ == ‘__main__‘:

main()

原文:https://www.cnblogs.com/walkwaters/p/12128016.html

到了這里,關(guān)于用python寫的新年快樂的代碼,python節(jié)日祝福源代碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 用python給朋友做生日快樂祝福

    用python給朋友做生日快樂祝福

    主要使用python的turtle庫進(jìn)行繪制 speed控制畫筆的速度,大小在(0, 10),0是最快的 代碼如下 這里是運(yùn)行效果圖 主要使用pygame實(shí)現(xiàn)煙花效果 代碼如下 其中這個(gè)是煙花的背景圖,“happy birthday”是圖片的名字,這個(gè)圖片需要和.py文件放在一個(gè)文件夾里面 運(yùn)行結(jié)果截圖如下 導(dǎo)

    2024年02月13日
    瀏覽(25)
  • C語言系列之炫酷新年煙花秀(帶新年祝福)

    C語言系列之炫酷新年煙花秀(帶新年祝福)

    新年即將到來,由于全國各地的政策不一樣,也許有的地方會(huì)禁止燃放煙花,那么就來一款別開生面的電子煙花,讓大家感受一下過年的氛圍吧。 代碼呈上: 小伙伴們快去試試吧!!

    2024年02月03日
    瀏覽(22)
  • 以AI作畫,祝她節(jié)日快樂

    近期,ChatGPT的爆火,引起了大眾對于AIGC(AI Generate Content AI生成內(nèi)容)的廣泛關(guān)注。作為技術(shù)領(lǐng)域的又一熱點(diǎn)話題——AIGC距離大眾使用似乎還存在一定距離? 等風(fēng)來不如追風(fēng)去。隨著第113個(gè)“三·八”國際婦女節(jié)于春日中悄然來臨,OpenVINO? 特推出“以AI作畫,祝她節(jié)日快樂

    2024年02月11日
    瀏覽(18)
  • BUUCTF中的“新年快樂”

    BUUCTF中的“新年快樂”

    0x00 前言 今天看了一下日期,距過年還有28天,正好今天做的題目也叫新年快樂,就提前給大家拜個(gè)早年,祝大家早年幸福。 0x01 正文 雖然是新年快樂的題,但是打開是一點(diǎn)兒都不快樂,它讓我輸入flag。 既然這樣的話,那只好PE一下打開看看啰。 ? 于是,遇見了做題以來的

    2024年02月08日
    瀏覽(22)
  • Go語言實(shí)現(xiàn)新年快樂的效果

    在 Go 語言中,你可以使用 fmt 包來實(shí)現(xiàn)新年快樂的效果。以下是一個(gè)簡單的例子: 在這個(gè)例子中,我使用 ANSI 轉(zhuǎn)義碼來設(shè)置輸出的顏色。 \\033[31m 表示紅色, \\033[32m 表示綠色, \\033[33m 表示黃色, \\033[36m 表示青色, \\033[35m 表示紫色, \\033[0m 用于重置顏色。 請注意,在不同的終

    2024年01月23日
    瀏覽(24)
  • 新年快樂—數(shù)睿通2.0數(shù)據(jù)中臺(tái)全新功能模塊發(fā)布

    新年快樂—數(shù)睿通2.0數(shù)據(jù)中臺(tái)全新功能模塊發(fā)布

    離上次發(fā)文已經(jīng)有接近三個(gè)月了,這三個(gè)月主要在開發(fā)數(shù)睿通的數(shù)據(jù)生產(chǎn)模塊,同時(shí)優(yōu)化了一下數(shù)據(jù)集成,目前已經(jīng)基本開發(fā)完畢了,集成了 Flink,Hadoop,可以在線開發(fā) FlinkSql 作業(yè)任務(wù),同時(shí)支持 Sql 任務(wù)開發(fā),使平臺(tái)初步具備了拉數(shù),造數(shù)的能力,正值新年,在這里給大家

    2024年02月02日
    瀏覽(21)
  • 新年快樂!學(xué)習(xí)Java第84天,Maven工程繼承和聚合關(guān)系

    1. Maven工程繼承關(guān)系 繼承概念 Maven 繼承是指在 Maven 的項(xiàng)目中,讓一個(gè)項(xiàng)目從另一個(gè)項(xiàng)目中繼承配置信息的機(jī)制。繼承可以讓我們在多個(gè)項(xiàng)目中共享同一配置信息,簡化項(xiàng)目的管理和維護(hù)工作。 繼承作用 在父工程中統(tǒng)一管理項(xiàng)目中的依賴信息。 它的背景是: 對一個(gè)比較大型

    2024年02月03日
    瀏覽(22)
  • 母親節(jié)快到了,祝所有母親節(jié)日快樂!Happy Mother‘s Day

    母親節(jié)快到了,祝所有母親節(jié)日快樂!Happy Mother‘s Day

    《游子吟》唐·孟郊 慈母手中線,游子身上衣。 臨行密密縫,意恐遲遲歸。 誰言寸草心,報(bào)得三春暉。 My kind mother has a needle and thread in her hand,Making new clothes for her son who is to travel far away. She is busy sewing closely before my leaving,Worried that I cannot come back for a long time. Who says that the h

    2024年02月04日
    瀏覽(20)
  • 以AI作畫,祝她節(jié)日快樂;簡單三步,OpenVINO? 助你輕松體驗(yàn)AIGC

    以AI作畫,祝她節(jié)日快樂;簡單三步,OpenVINO? 助你輕松體驗(yàn)AIGC

    近期,ChatGPT的爆火,引起了大眾對于AIGC(AI Generate Content AI生成內(nèi)容)的廣泛關(guān)注。作為技術(shù)領(lǐng)域的又一熱點(diǎn)話題——AIGC距離大眾使用似乎還存在一定距離? 等風(fēng)來不如追風(fēng)去。隨著第113個(gè)“三·八”國際婦女節(jié)于春日中悄然來臨,OpenVINO? 特推出“以AI作畫,祝她節(jié)日快樂

    2024年02月08日
    瀏覽(17)
  • Python新年煙花代碼

    Python新年煙花代碼

    Pygame 繪制煙花的基本原理 1,發(fā)射階段:在這一階段煙花的形狀是線性向上,通過設(shè)定一組大小不同、顏色不同的點(diǎn)來模擬“向上發(fā)射” 的運(yùn)動(dòng)運(yùn)動(dòng),運(yùn)動(dòng)過程中 5個(gè)點(diǎn)被賦予不同大小的加速度,隨著時(shí)間推移,后面的點(diǎn)會(huì)趕上前面的點(diǎn),最終所有點(diǎn)會(huì)匯聚在一起,處于 綻放

    2024年02月03日
    瀏覽(31)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包