Lv.1
在 【Python作品分享】我的文件-8【求助帖】 中回复
没问题呀,你那个应该是控制台的效果,不过你没有相关的代码呀:
import turtle as t
t.speed(0)
t.ht()
t.pencolor('orange')
t.pensize(5)
t.goto(0, 0)
t.left(45)
for u in range(6):
t.forward(100)
t.right(120)
for i in range(3):
t.forward(60)
t.right(360/3)
t.left(120)
t.backward(100)
t.left(60)
t.done()
我运行的效果是:

你看看要的是不是这个效果。
最后发个表情包嘲讽一下:

哈哈(</没电摇图片,视屏/>).

2023-07-13T12:42:09 点赞:0
在 BEST工作室教程:认知AI的花样用法 中回复
我现在学python,给大家搞个硬核ChatGPT:
import openai
# 设置OpenAI API密钥
openai.api_key = "YOUR_API_KEY"
# 对话生成函数
def generate_response(prompt):
response = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
temperature=0.7,
max_tokens=100,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.0
)
return response.choices[0].text.strip()
# 与Chatbot GPT交互
def chat_with_gpt():
print("Chatbot GPT启动成功!输入'exit'退出对话。")
while True:
user_input = input("User: ")
if user_input.lower() == "exit":
break
prompt = f"User: {user_input}\nChatbot GPT:"
response = generate_response(prompt)
print(response)
# 运行Chatbot GPT程序
chat_with_gpt()
注:代码里的YOU_API_KEY指的是你申请的OpenAI账号里的OpenAI key秘钥,要使用自行申请。
2023-08-01T09:44:40 点赞:1
在 【Python作品分享】小测试【求助帖】 中回复
选项为啥不用easygui?不会?我教你:
import easygui
#开始进入Python的世界
easygui.msgbox('开始答题', 'Codemao', 'yes')
if easygui.ynbox('是否继续?'):
pass
elif False:
pass
else:
pass
2023-08-01T09:52:52 点赞:0
在 【Python作品分享】小测试【求助帖】 中回复
甚至可以这样玩:
"""
.. moduleauthor:: easygui developers and Stephen Raymond Ferg
.. default-domain:: py
.. highlight:: python
Version |release|
ABOUT EASYGUI
=============
EasyGUI provides an easy-to-use interface for simple GUI interaction
with a user. It does not require the programmer to know anything about
tkinter, frames, widgets, callbacks or lambda. All GUI interactions are
invoked by simple function calls that return results.
.. warning:: Using EasyGUI with IDLE
You may encounter problems using IDLE to run programs that use EasyGUI. Try it
and find out. EasyGUI is a collection of Tkinter routines that run their own
event loops. IDLE is also a Tkinter application, with its own event loop. The
two may conflict, with unpredictable results. If you find that you have
problems, try running your EasyGUI program outside of IDLE.
.. note:: EasyGUI requires Tk release 8.0 or greater.
LICENSE INFORMATION
===================
EasyGUI version |version|
Copyright (c) 2014, Stephen Raymond Ferg
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ABOUT THE EASYGUI LICENSE
-------------------------
| This license is what is generally known as the "modified BSD license",
| aka "revised BSD", "new BSD", "3-clause BSD".
| See http://www.opensource.org/licenses/bsd-license.php
|
| This license is GPL-compatible.
| See `<http://en.wikipedia.org/wiki/License_compatibility>`_
| See http://www.gnu.org/licenses/license-liglobal_state.html#GPLCompatibleLicenses
|
| The BSD License is less restrictive than GPL.
| It allows software released under the license to be incorporated into proprietary products.
| Works based on the software may be released under a proprietary license or as closed source software.
| `<http://en.wikipedia.org/wiki/BSD_licenses#3-clause_license_.28.22New_BSD_License.22.29>`_
API
===
"""
if __name__ == '__main__':
from boxes.demo import easygui_demo
easygui_demo()
# from boxes.alt_text_box import demo_textbox
# demo_textbox()
2023-08-01T09:54:07 点赞:0
在 【求助帖】 中回复
1.import turtle
2.
3.
4.
5.
6.turtle.done()
或者:
1.import turtle as t
2.
3.
4.
5.
6.t.done()
注:
t.done后面的括号里面填秒数,向这样t.done()不填是无限。
2023-08-01T09:58:52 点赞:0
在 【Python作品分享】我的世界1-副本【作品秀】 中回复
把材质包发过来呀
没图片
啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊
2023-08-01T10:05:38 点赞:1
在 【Python作品分享】摩斯密码编码器 中回复
让你们见识见识:
import easygui
#开始进入Python的世界
if (easygui.ynbox('编码解码', '摩斯密码一体机',('编码', '解码')) == 1):
import time as t
# 开始进入Python的世界
# 导入数据
list_symbol = ['~', '!', '@', '#', '$', '\%', '^', '&', '*', '(', ')', '-------', '=', '+', '|', '{', '}', '[', ']', ';', ':', "'", '<', '>', ',', '。', '?', ' ', '.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', '..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.', '--.-', '.-.', '...', '-', '..-', '...-', '.--', '-..-', '-.--', '--..', '.----', '..---', '...--', '....-', '.....', '-....', '--...', '---..', '----.', '-----']
list_litter = ['~', '!', '@', '#', '$', '\%', '^', '&', '*', '(', ')', '-------', '=', '+', '|', '{', '}', '[', ']', ';', ':', "'", '<', '>', ',', '。', '?', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
list_py = []
list_pyc = []
# 验证无误
if (len(list_symbol) == len(list_litter)):
print('确认无误,可以使用。')
elif (len(list_symbol) != len(list_litter)) :
print('错误,请维修。(数据库的问题)')
print('错误码:',len(list_symbol))
print('错误码:',len(list_litter))
t.sleep(99999)
else :
print('其他错误')
t.sleep(99999)
# 查询翻译内容
a = input('要加密的内容,请翻译成英文,只支持部分符号(空格),留数字和英文,大写换小写。:')
# 开始翻译
z = 0
for f in range(len(a)):
list_py.append(a[z])
z = (z + 1)
for b in list_py:
for c in list_litter:
if (c == b):
list_pyc.append(list_symbol[list_litter.index(c)])
jieguo = '/'.join(list_pyc)
# 结果汇报
print('输入:')
print(a)
print('结果:')
print(jieguo)
else :
print('-----------------------------------')
print('| 作品原创 |')
print('| 禁止喷子 |')
print('| 2023/8/1 |')
print('| 星期二 |')
print('| 9:30 |')
print('| ********************************|')
print('-----------------------------------')
import time as t
# 开始进入Python的世界
# 导入数据
list_symbol = ['~', '!', '@', '#', '$', '\\\%', '^', '&', '*', '(', ')', '-------', '=', '+', '|', '{', '}', '[', ']', ';', ':', "'", '<', '>', ',', '。', '?', ' ', '.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', '..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.', '--.-', '.-.', '...', '-', '..-', '...-', '.--', '-..-', '-.--', '--..', '.----', '..---', '...--', '....-', '.....', '-....', '--...', '---..', '----.', '-----']
list_litter = ['~', '!', '@', '#', '$', '\\\%', '^', '&', '*', '(', ')', '-------', '=', '+', '|', '{', '}', '[', ']', ';', ':', "'", '<', '>', ',', '。', '?', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
list_py = []
list_pyc = []
# 验证无误
if (len(list_symbol) == len(list_litter)):
print('确认无误,可以使用。')
elif (len(list_symbol) != len(list_litter)) :
print('错误,请维修。(数据库的问题)')
print('错误码:',len(list_symbol))
print('错误码:',len(list_litter))
t.sleep(99999)
else :
print('其他错误')
t.sleep(99999)
# 查询翻译内容
temp = input('把编码器的结果粘贴到这里来:')
a = temp.split('/')
# 开始翻译
z = 0
for f in range(len(a)):
list_py.append(a[z])
z = (z + 1)
for b in list_py:
for c in list_symbol:
if (c == b):
list_pyc.append(list_litter[list_symbol.index(c)])
# 结果汇报
print('输入:')
print(temp)
print('结果:')
for jieguo in list_pyc:
print(jieguo)
2023-08-01T10:18:47 点赞:0