Hi, I am trying to create a json file that stores my users email for subscription purposes. I get an error that says, 'Type error: dump() missing 1 required positional'. Here is my code:
print('Welcome to the Urban ')
import json
import username
import favartist
def userfav():
userfav = input('Please select your favorite artist: \n ')
a = 'Yes' or 'yes'
ab = 'No' or 'no'
if userfav == 'Drake':
subs = input('Would you like to subscribe to notifications for Drake?:')
if subs == a:
print('Thank you for subscribing')
elif subs == ab:
print('You ca subscribe later')
else:
print('Selection is invalid')
elif userfav == 'J.Cole':
subs = input('Would you like to subscribe to notifications for J.Cole?:')
if subs == a:
print('Thank you for subscribing')
elif subs == ab:
print('You ca subscribe later')
else:
print('Selection is invalid')
elif userfav == 'Anderson Paak':
subs = input('Would you like to subscribe to notifications for Drake?:')
if subs == a:
print('Thank you for subscribing')
ussubem()
elif subs == ab:
print('You ca subscribe later')
else:
print('Selection is invalid')
userfav()
def ussubem():
userfav = True
a = True
sub_e = input('Please enter your subscription email: \n ')
em = sub_e
return print('Thank you, will now receive regular emails about The Urban Macchiato to,' + sub_e)
ussubem()
with open('usersub.json', 'w+') as json_file:
json.dump(ussubem)
