posted on 2023-05-03 20:05 read(263) comment(0) like(4) collect(2)
In view of the fact that many friends are not very good at running, I will add my running method here~ (for python), those who don’t know how to run can just click "Run Steps"~
1. Python code (love.py)
- import time
- words = "love"
- print('\n')
- for item in words.split():
- letterlist = []
- for y in range(12, -12, -1):
- list_X = []
- letters = ''
- for x in range(-30, 30):
- expression = ((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3
- if expression <= 0:
- letters += item[(x-y) % len(item)]
- else:
- letters += ' '
- list_X.append(letters)
- letterlist += list_X
- print('\n'.join(letterlist))
- time.sleep(0.5);
- print('\n to 茂茂酱!!\n\n')
-
Running diagram:
Two, python code (love.py)
- import turtle as t
-
- # 布置画布和设置画笔配置
- t.setup(width=800, height=500) #窗口(画布)大小
- t.color('pink', 'pink') #画笔填充颜色
- t.pensize(3) #画笔粗细
- t.speed(1.5) #描绘速度
-
- # 开始画
- t.begin_fill() #开始填充颜色
- t.up() # 提笔
- t.goto(0, -100) # 移动画笔到指定坐标
- t.down() # 下笔
- t.left(45) #笔向向左45度
- t.forward(200) #画出长度为200的直线
- t.circle(100,180) #绘制直径为100,角度为180度的半圆
- t.right(90) #笔向向右90度
- t.circle(100,180) #绘制直径为100,角度为180度的半圆
- t.forward(200) #画出长度为200的直线
- t.end_fill() #结束填充颜色
-
- # 写文字
- t.up() #提笔
- t.goto(-120, -120) #移动画笔到指定坐标
- t.down() #下笔
- t.write('祝茂茂',align='center',font=('宋体','20')) #文字可以随意调整,slign是对齐方式,font是字体和字号
- t.up() # 提笔
- t.goto(120, -120) #移动画笔到指定坐标
- t.down() #下笔
- t.write('天天开心',align='center',font=('宋体','20'))
Running diagram:
3. C language code (love.c)
- #include<stdio.h>
- #include<Windows.h>
-
- int main()
- {
- float x,y,a;
- for(y=1.5; y>-1.5; y-=0.1)
- {
- for(x=-1.5; x<1.5; x+=0.05)
- {
- a=x*x+y*y-1;
- putchar(a*a*a-x*x*y*y*y<=0.0?'*':' ');
- }
- system("color 0c");
- putchar('\n');
- }
- printf("\t\t\t\t\t茂茂天天开心~\n\n");
- return 0;
- }
Running diagram:
Since many friends are not very good at running, I will add my running method here~ (for python)
Step 1: Create a folder anywhere (preferably the desktop, it will be convenient to delete it later~)
Step 2: Open the Test folder, enter, create a file with the suffix .py, and name it randomly
//No, no, if you want to learn programming, if the computer can't directly change the suffix, then it's not competent enough~ (fork away, go to Baidu)
Step 3: Enter cmd on the navigation side and press enter (shortcut terminal mode)
Step 4: Enter python+space+the full name of the python file you created. The example is as follows:
python love.py
press enter to run
Pure nanny level~~~~~
Author:Fiee
link:http://www.pythonblackhole.com/blog/article/272/9d2e58901b7c86e3e890/
source:python black hole net
Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.
name:
Comment content: (supports up to 255 characters)
Copyright © 2018-2021 python black hole network All Rights Reserved All rights reserved, and all rights reserved.京ICP备18063182号-7
For complaints and reports, and advertising cooperation, please contact vgs_info@163.com or QQ3083709327
Disclaimer: All articles on the website are uploaded by users and are only for readers' learning and communication use, and commercial use is prohibited. If the article involves pornography, reactionary, infringement and other illegal information, please report it to us and we will delete it immediately after verification!