第一题 package net.mindview.innerclasses; public class Outer { class Inner { Inner(){ System.out.println("这是一个内部类"); } } public Inner in(){ return new Inner(); } public static void main(String[] args) { Outer out = new Outer(); Outer.Inner inner =…
编写一个名为display_message() 的函数,它打印一个句子,指出你在本章学的是什么.调用这个函数,确认显示的消息正确无误 def display_message(): print("I'm learning about functions in chapter 8\n") display_message() 编写一个名为favorite_book()的函数,其中包含一个名为title的形参.这个函数打印一条消息,如One of my favorite books is Al…
2.3 个性化消息:将用户的姓名存到一个变量中,并向该用户显示一条消息.显示的消息应非常简单,如"Hello Eric, would you like to learn some Python today?" name ="Eric" print(f"Hello {name}, would you like to learn some Python today?") 2.4 调整名字的大小写: 将一个人名存储到一个变量中,再以小写.大写和首字母大…
编写一个程序,询问用户要租赁什么样的汽车,并打印一条消息,如"Let me see if I can find you a Subaru" car =input("What kind ofretal car you would like:") print(f"Let me see if I can find you a {car}") 编写一个程序,询问用户有多少人用餐.如果超过8人,就打印一条消息,指出没有空桌;否则指出有空桌 people =…