New in python,questions at the numbers datatype


You are going shopping. Let’s make a grocery list so that you can plan your budget.

Store the number of cucumbers you want to buy in a variable called cucumbers. Make sure it’s at least 1, and that it’s the appropriate datatype! The store doesn’t sell partial cucumbers.

so I declare int cucumbers=1

but when i run it, it says wrong.


You are thinking Java, but in python you don’t need the int. The way you define variables in python is like this:

variableName = "yourString"
variableName2 = 4
variableName3 = True



python automatically assigns the right data type, this is different from language like C and Java where you have to specify the data type.


Please post a link to the exercise you are on or this topic will never make sense.


Huh, for some reason I wasn’t able to reply but its good now(which was why I put the link in my original post).


Thank you so much! Now I got it


ok I got it I was wondering why it would be wrong, thank you !


@gtang2015 Awesome! Congrats :tada:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.