Open Spandan-Madan opened 4 years ago
Hi, When I am trying to write the whole code in one go, it shows some error, but when I wrote the attributes as separate codes, there was an output. Is it important to write the code for each attribute separately?
@Malvika08 Could you create a new issue for this please? This issue was created by me to track problems people face! One issue per problem ensures that people can easily go through it when they're stuck with a problem themselves.
Thanks!
I'm compiling a list of errors people make here -
Pitfall 1
Using wrong brackets. When you want to see the elements in a list, you use the square brackets like this []. If you use () it will give you an error. So, content[0] would work, but content(0) in lecture_1.ipynb would give you errors. Or break the code, as programmers call it.
Pitfall 2
In the lecture_1.ipynb file, when I split a line I use split(','). This means we split the string into parts at every , in the string. So:
string_1 = 'hello,hi,bye' parts = string_1.split(',') print(parts[0])
Would print :
hello
But in the assignment we need to split on NOT a , but a space.
string_2= 'hello hi bye' parts = string_1.split(' ') print(parts[0])
would print:
hello
If the string does not have , and you split on it, you will get back the string without being split. For ex:
string_1 = 'hello hi bye' parts = string_1.split(',') print(parts[0])
Would print :
hello hi bye
As the string was asked to be split on a comma, while you needed to split it on a space bar (i.e. the space bar character on your keyboard.