'this def function I've made does not output the value specified by print [duplicate]
I've made this simple program that uses a def function to output one of the components of a list. The component isn't being printed as specified in the code, which is really confusing me. Any help would be appreciated.
Members = ["fine", "Mine"]
def Helpers():
print("Helpers who wanna work work work")
for record in Members:
if(record[0] == "fine"):
print(record[1])
Helpers()
Solution 1:[1]
your problem that you use index on record that take the first letter position
you should run withou index
Members = ["fine", "Mine"]
def Helpers():
print("Helpers who wanna work work work")
for record in Members:
if(record == "fine"):
print(record)
Helpers()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Beny Gj |
