你可以使用ChatGPT进行调试、代码生成、重构、注释等操作。它可以处理40多种编程语言的代码。
| 上古语言 | 早期语言 | 近期语言 | 先锋语言 |
|---|---|---|---|
| BASIC | Perl | Swift | Kotlin |
| Assembly | Pascal | TypeScript | Julia |
| Fortran | PHP | Rust | Crystal |
| Lisp | Prolog | Kotlin/Native | Racket |
| COBOL | C | Julia (GPU) | Lua |
| Algol | PL/I | Go | Zig |
| SNOBOL | C++ | Dart | Nim |
| RPG | Smalltalk | Elixir | Crystal (LLVM) |
| Forth | Tcl | Groovy | Vlang |
| Ada | SQL | Scala Native | Erlang |
代码生成
指导ChatGPT生成代码,就像呼吸一样简单::
Act as a junior python programmer. Please write the code to generate madlibs from 3 arrays of 6 items each: prepositions, verbs and nouns, with the nouns also being used as direct objects. After writing it, execute the code.
输出结果可能像下面一样:
import randomprepositions = ['at', 'in', 'on', 'with', 'under', 'over']verbs = ['run', 'jump', 'dance', 'sing', 'laugh', 'cry']nouns = ['cat', 'dog', 'tree', 'flower', 'book', 'computer']preposition = random.choice(prepositions)verb = random.choice(verbs)noun = random.choice(nouns)madlib = f"I {verb} {preposition} the {noun}."print(madlib)
试试这个Dyno插件的功能:
提示词:
扮演一名初级 Python 程序员。请编写代码,从 3 个数组(每个数组包含 6 个项目)生成 madlib:介词、动词和名词,名词也用作直接宾语。
AI 回复:
# Create arrays of prepositions, verbs, and nounsprepositions = ["in", "on", "under", "above", "beside", "through"]verbs = ["ran", "jumped", "skipped", "crawled", "danced", "climbed"]nouns = ["tree", "rock", "bush", "flower", "house", "hill"]# Create a for loop to iterate through the arraysfor i in range(len(prepositions)):# Print the madlibsprint("The rabbit "+verbs[i]+" "+prepositions[i]+" the "+nouns[i]+".")
