Using Python & import sys, use argvs to create a program, luke.py, using the following dictionary: relations = {'Darth V

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Using Python & import sys, use argvs to create a program, luke.py, using the following dictionary: relations = {'Darth V

Post by answerhappygod »

Using Python & import sys, use argvs to create a program,luke.py, using the following dictionary:
relations = {'Darth Vader':'father', 'Leia':'sister','Han':'brother in law', 'R2D2':'droid', 'Rey':'Padawan','Tatooine':'homeworld'}
The program will take one argument, corresponding to one of therelations’ keys. The program will print out the statement:
Luke, I am your x
Where x = the relationship.
For example, if the argument is Leia, it should print ‘Luke, Iam your sister’ and if the key is ‘Darth Vader’ you should insteadprint “No, I am your father”
You should only need one single if-else statement at most.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply