Pretty straight forward question. When do we need to define a parameter in a function and when do we not need to?
Screen Link: https://app.dataquest.io/m/316/functions%3A-intermediate/9/scopes-global-and-local
Your Code: def exponential(x):
e = 2.72
print(e)
return e**x
result = exponential(5)
print(e)
In this function, why do we need to include the x in the def exponential(x): compared to other times when we define a function where we could just leave the def exponential() empty.
If left empty (def exponential():) I get this error:
- TypeErrorTraceback (most recent call last) in () 8 return e**x 9 —> 10 result = exponential(5) 11 print(e) 12 TypeError: exponential() takes 0 positional arguments but 1 was given
Also in this section: https://app.dataquest.io/m/316/functions%3A-intermediate/7/more-about-tuples
Can somebody explain to me how this part of the solution:
- apps_data, header = open_dataset()
is working step by step?
The problem " Use the open_dataset()
function to open the AppleStore.csv
file, which has a header row" confuses me because don’t I need to use the open_dataset to get the apps_data?