Create a function (make_car) in your dictionary that stores car information and save it to carfunc.py! This function must always receive the manufacturer name and model name. And you need to receive a random number of keyword parameters.
When you import the above function module to call a function, write a program that puts in the required information and colors, adds two key-value pairs, such as options and functions, and prints the results.
Call Example
car = carfunc.make_car('modern', 'granger', color='blue', blackbox='equipped')
It's an example question, but I don't know how to code it Help!
python
#!/usr/bin/env python3
## ## ~/carfunc.py
def make_car(maker, model, **kwargs):
print(kwargs.get("color"))
pass
make_car ("Hyundai Kia", "Grenzer", color="red")
I wrote only the parts that could be a little difficult.
I think the kwargs part was difficult.
If you look at the code above, I think you can get the hang of it right away.
562 Understanding How to Configure Google API Key
573 Uncaught (inpromise) Error on Electron: An object could not be cloned
826 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
561 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
582 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.