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.
Using Python & import sys, use argvs to create a program, luke.py, using the following dictionary: relations = {'Darth V
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am