函数可以没有返回值案例,编写一个函数,从终端输入一个整数,打印出对应的金字塔 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("…
在屏幕上输出一个杨辉三角,代码如下 def yanghui(): L = [1] while True: yield L L.append(0) L = [L[i - 1] + L[i] for i in range(len(L))] a = yanghui() for i in range(10) printf(next(a))…