Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Ammar Fatihallah
7,417 PointsSkipping commands problem
So i have this project that i started working and I'm really puzzled why the code in the Welcome(given_data)
(starting from the if
condition) just skips and doesn't do any of the commands.
Here's my code:
given_data = []
def Welcome(given_data):
print("Welcome to the life predictor \n ")
print('''Instructions: \n
1) To enter new data, type NEWDATA, press ENTER, and type the number of data you wish to enter.
2) To enter data for analysis, type START.
3) To quit, type QUIT. ''')
command = input(">>> ")
if command.upper == 'NEWDATA':
data_enter = input("How many data sets ? >>> ")
for DATA in range(0, data_enter):
Name = input("Student name\s (default is 'No name Given'): ")
pH = int(input("pH: "))
Nitrite = int(input("Nitrite: "))
Nitrate = int(input("Nitrate: "))
DO = int(input("D.O : "))
Saturation = int(input("Saturation: "))
try:
given_data.append({Name, pH, Nitrite, Nitrate, DO, Saturation})
except ValueError:
print("Error :( Wrong Value entered. Make sure data is integers and not decimals.")
elif command.upper() == 'START':
pass
Welcome(given_data)
3 Answers

Darel Bitsy
6,910 Pointsfirst the parameter of your function need to be named something else than given_data, second string upper it's a method so () needed , last data_enter need to be converted to int because range function accept int value not string

Darel Bitsy
6,910 PointsHere is working code given_data = []
def Welcome(some_date): print("Welcome to the life predictor \n ") print('''Instructions: \n 1) To enter new data, type NEWDATA, press ENTER, and type the number of data you wish to enter. 2) To enter data for analysis, type START. 3) To quit, type QUIT. ''') command = input(">>> ")
if command.upper() == 'NEWDATA':
data_enter = int(input("How many data sets ? >>> "))
for DATA in range(0, data_enter):
Name = input("Student name\s (default is 'No name Given'): ")
pH = int(input("pH: "))
Nitrite = int(input("Nitrite: "))
Nitrate = int(input("Nitrate: "))
DO = int(input("D.O : "))
Saturation = int(input("Saturation: "))
try:
some_date.append({Name, pH, Nitrite, Nitrate, DO, Saturation})
except ValueError:
print("Error :( Wrong Value entered. Make sure data is integers and not decimals.")
elif command.upper() == 'START':
pass
Welcome(given_data)

Ammar Fatihallah
7,417 PointsCan you please tell me what was wrong with my code ?

Darel Bitsy
6,910 PointsYou are Welcome ! keep coding !
Ammar Fatihallah
7,417 PointsAmmar Fatihallah
7,417 PointsThank you so much man , i don't even know how to thank you :)