My goal is as follows:
elements()
with no arguments.ele
.ele
.s_elements
."So your favorite chemical elements are Na, K, Mg"
.So far, I have
def elements():
ele = input("What are your three favorite chemical elements? ")
s_elements=print ele
print("So your favorite chemical elements are", s_elements)
I'm getting an error with print ele
and the function is not working properly. How can I fix this?
You are not following the instructions of your assignment properly.
You are supposed to return ele
. So first:
def elements():
ele = input("What are your three favorite chemical elements? ")
return ele
Then, your assignment states you need to call the method and store it in s_elements
:
s_elements = elements()
Then you are supposed to print it, which that part you have done properly:
print("So your favorite chemical elements are", s_elements)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.