Replace this line with your code
What I expected to happen:
What actually happened:
Replace this line with the output/error
I understand this is trying to teach using lists for iteration. Would it not be better to teach how to clean data, input information properly into a database, and then iterate on that information?
Can you please elaborate your question. ‘database’ part really confuses me here.
Is the provided screen-link is where you are finding an issue or the link is a typo?
Something such as sqllite or mysql? Does each row need to be a list?
This is interesting!
I don’t know in what track you are and in what sequence you are following the courses/ missions at DataQuest.
But this mission is under fundamentals, absolute basics. So SQLite and MySql would also be considered as advance courses for beginners. You may have experience with them, but this mission caters to people who are just getting introduced to Python.
the course content explains it well but I will just try so that you get an idea:
x = 6 this is variable x of type int (integer)
pi_val = 3.14 this is variable pi_val of type float
course = "python" this is variable course of type str (string)
combo = [x, pi_val, course ] this is variable combo of type List (the one this mission talks about)
the row here is not the SQLite table row, it’s just the variable named “row1”, “row2”, etc.
hope it helps.
Maybe I am confusing something from excel / possibly a pivot table and am wanting to substitute using a database to store information. Can you link me to those missions?
if you are trying to complete just this mission, you don’t need any of it. excel/ pivot table/ or database table.
but if you are working on extra or personal projects which actually involves these, then you will have to provide us more context.
are these tasks confusing you?
perhaps you are taking the “Store the … row” literally. its not related to database. it’s just assign the given list to a variable “row_2”. like so:
row_2 = ['Instagram', 0.0, 'USD', 2161558, 4.5] that is all you have to do.
and this is how you will see the result.
just try this code:
print(type(row_2)) and see the result.
Would it be easier to store the information in a table in a database in the long run?
Or is making a list the best answer for each row? You then have to remember what is at each index?
I am not sure what exactly your objective is.
It’s my assumption you are mixing up multiple concepts here. Most likely mixing up simple things from one tech with complex topics you are currently learning or already know about another tech.
Anyhow, of course, when we have to deal with a large amount of data, best structures would be database tables. But then it’s not just storage, we will have to deal with then, it’s also the complexity these structures have and the simple/ complex queries we will have to create in order to extract/ use the stored information!
This really does not go with this topic on the forum. I am trying scrape data into Jupyter notebook and then have that data go into a back-end database.
Hello, everyone! This is a question about list slicing. It seems simple, but i just don’t understand.
When you are slicing a list, why does the final number have to be N+1?
a_list = [2,4]
but you want the third number on the list as the last one? Im confused about this.
thank you, all in advance!
this is the mission link:
I may not be helping you at all with this. But my confusion was this: in the real world, when is it actually practical to store an entire row of a table in a list? Is it not better to store information so each row has a name and each column has a name? That was really all I was getting at.
Your confusion may simply be due to zero based indexing.
I still don’t know how much this will help you, but let us say you are working with a table which has only 4 columns and 5 rows.
Are you sure you want to log in to a database, create a table, store these rows, and every time you need them - you will make a connection with the database, fetch the query, store the query result somewhere (assuming you are working with SQL and Python together) close the connection and work on your fetched results thereafter? Every time!?
Or while working on such a small number of records you would prefer a small structure that can be created once and modified or updated during the workflow.?
let us know your thoughts.
I understand the rationale for both use cases.
I am new in Phyton and recently I found a weird case.
I cannot print the result after I created the list and record them in variables.
Anyway, I am already in Step 6, between Step 1-Step 5, I can print the result.
After step 6, I try to do trial and error to solve the problem. However, when I got this error in step 6 :TypeError: ‘list’ object is not callable
Then, I reset my progress, and come back again to Step 1
Now, The print function is screwed up and I cannot print my result. Here is the error:
I assume this is because phyton set up some memory in my virtual machine or as a cache.
However, I cannot find how to clear the cache/memory.
Could someone tell me how to clear the cache/memory of my virtual machine?
You should be able to type clear.
Hi @christian.ricky, welcome to the community!
This post might be able to help you resolve the issue: TypeError: 'x' object is not callable
Hi. Sorry for late replying.
The solution is incorrect. I type in the interface, console and no command for “clear”