Skip to content

Commit e0b7fa5

Browse files
committed
Replace strings which is not supported in windows for file's name
1 parent 998aa3a commit e0b7fa5

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'''
2-
Function with variable-length arguments (*args)
2+
Function with variable-length arguments (-args)
33
100xp
44
55
Flexible arguments enable you to pass a variable number of arguments to a function.
@@ -15,16 +15,16 @@
1515
1616
Instructions
1717
-Complete the function header with the function name gibberish. It accepts a single flexible
18-
argument *args.
18+
argument -args.
1919
-Initialize a variable hodgepodge to an empty string.
2020
-Return the variable hodgepodge at the end of the function body.
2121
-Call gibberish() with the single string, "luke". Assign the result to one_word.
2222
-Hit the Submit button to call gibberish() with multiple arguments and to print the value
2323
to the Shell.
2424
'''
2525
# Define gibberish
26-
def gibberish(*args):
27-
"""Concatenate strings in *args together."""
26+
def gibberish(-args):
27+
"""Concatenate strings in -args together."""
2828

2929
# Initialize an empty string: hodgepodge
3030
hodgepodge = ""
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
'''
2-
Function with variable-length keyword arguments (**kwargs)
2+
Function with variable-length keyword arguments (--kwargs)
33
100xp
44
5-
Let's push further on what you've learned about flexible arguments - you've used *args,
6-
you're now going to use **kwargs! What makes **kwargs different is that it allows you to
5+
Let's push further on what you've learned about flexible arguments - you've used -args,
6+
you're now going to use --kwargs! What makes --kwargs different is that it allows you to
77
pass a variable number of keyword arguments to functions. Recall from the previous video
88
that, within the function definition, kwargs is a dictionary.
99
10-
To understand this idea better, you're going to use **kwargs in this exercise to define a
10+
To understand this idea better, you're going to use --kwargs in this exercise to define a
1111
function that accepts a variable number of keyword arguments. The function simulates a
1212
simple status report system that prints out the status of a character in a movie.
1313
1414
Instructions
1515
-Complete the function header with the function name report_status. It accepts a single
16-
flexible argument **kwargs.
16+
flexible argument --kwargs.
1717
-Iterate over the key-value pairs of kwargs to print out the keys and values, separated
1818
by a colon ':'.
1919
-In the first call to report_status(), pass the following keyword-value pairs: name="luke",
@@ -22,7 +22,7 @@
2222
affiliation="sith lord" and status="deceased".
2323
'''
2424
# Define report_status
25-
def report_status(**kwargs):
25+
def report_status(--kwargs):
2626
"""Print out the status of a movie character."""
2727

2828
print("\nBEGIN: REPORT\n")
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
'''
2-
Using * and zip to 'unzip'
2+
Using - and zip to 'unzip'
33
100xp
44
55
You know how to use zip() as well as how to print out values from a zip object. Excellent!
66
77
Let's play around with zip() a little more. There is no unzip function for doing the
88
reverse of what zip() does. We can, however, reverse what has been zipped together by
9-
using zip() with a little help from *! * unpacks an iterable such as a list or a tuple
9+
using zip() with a little help from -! - unpacks an iterable such as a list or a tuple
1010
into positional arguments in a function call.
1111
12-
In this exercise, you will use * in a call to zip() to unpack the tuples produced by zip().
12+
In this exercise, you will use - in a call to zip() to unpack the tuples produced by zip().
1313
1414
Two tuples of strings, mutants and powers have been pre-loaded.
1515
1616
Instructions
1717
-Create a zip object by using zip() on mutants and powers, in that order. Assign the result to z1.
18-
-Print the tuples in z1 by unpacking them into positional arguments using the * operator
18+
-Print the tuples in z1 by unpacking them into positional arguments using the - operator
1919
in a print() call.
2020
-Because the previous print() call would have exhausted the elements in z1, recreate the
2121
zip object you defined earlier and assign the result again to z1.
22-
-'Unzip' the tuples in z1 by unpacking them into positional arguments using the * operator
22+
-'Unzip' the tuples in z1 by unpacking them into positional arguments using the - operator
2323
in a zip() call. Assign the results to result1 and result2, in that order.
2424
-The last print() statements prints the output of comparing result1 to mutants and result2
2525
to powers. Click Submit Answer to see if the unpacked result1 and result2 are equivalent to
@@ -34,14 +34,14 @@
3434
# Create a zip object from mutants and powers: z1
3535
z1 = zip(mutants, powers)
3636

37-
# Print the tuples in z1 by unpacking with *
38-
print(*z1)
37+
# Print the tuples in z1 by unpacking with -
38+
print(-z1)
3939

4040
# Re-create a zip object from mutants and powers: z1
4141
z1 = zip(mutants, powers)
4242

43-
# 'Unzip' the tuples in z1 by unpacking with * and zip(): result1, result2
44-
result1, result2 = zip(*z1)
43+
# 'Unzip' the tuples in z1 by unpacking with - and zip(): result1, result2
44+
result1, result2 = zip(-z1)
4545

4646
# Check if unpacked tuples are equivalent to original tuples
4747
print(result1 == mutants)

0 commit comments

Comments
 (0)