zoukankan      html  css  js  c++  java
  • 书籍练习题

    class Restaurant:
        def __init__(self,restaurant_name,cuisine_type,number_served=7):
            self.resraurant_name=restaurant_name
            self.cuisine_type=cuisine_type
            self.number_served=number_served
        def describe_restaurant(self):
            print('我的餐馆叫:%s'.ljust(3)%self.resraurant_name)
            print("我的菜肴类型是:%s"%self.cuisine_type)
            print("有【%s】人【%s】就餐过"%(self.number_served,self.resraurant_name))
        def open_restaurant(self):
            print("%s正在营业"%self.resraurant_name)
        def set_number_served(self,full):
            self.number_served=full
        def increment_number(self,up):
            self.number_served+=up
    
    
    class User:
        def __init__(self,first_name,last_name,login_attempts):
            self.first_name=first_name
            self.last_name=last_name
            self.login_attempts=login_attempts
        def describe_user(self):
            print("first_name:%s
    last_name:%s"%(self.first_name,self.last_name))
        def greet_user(self):
            print("hello,welcome to your word!")
        def increment_login_attempts(self):
            self.login_attempts+=1
        def reset_login_attempts(self):
            self.login_attempts=0
  • 相关阅读:
    c/c++(c++和网络编程)日常积累(二)
    docker日常积累
    c/c++日常积累
    qt日常积累
    YUV相关积累
    02-asio学习
    01--c实现基础客户端和服务端与c++ boost.asio实现对比
    webrtc学习笔记积累
    linux-日常工作积累
    用Java链接SQL Server
  • 原文地址:https://www.cnblogs.com/sxdpython/p/12746047.html
Copyright © 2011-2022 走看看