函数可以没有返回值案例,编写一个函数,从终端输入一个整数,打印出对应的金字塔 import scala.io.StdIn object work02 { def main(args: Array[String]): Unit = { println("请输入一个数") var num:Int=StdIn.readInt() val pige=(num:Int)=>{ for (i<-1 to num){ for (j<-1 to num-i){ print("…
import os def iterbrowse(path): for home, dirs, files in os.walk(path): for filename in files: yield os.path.join(home, filename) for fullname in iterbrowse("文件夹目录"): if fullname.endswith('.py'): print(fullname)…
import itertools str = input('请输入一个字符串:') lst = [] for i in range(1, len(str)+1): lst1 = [''.join(x) for x in itertools.permutations(str, i)] lst += lst1 print(lst) 主要使用的itertools库…