Hello am supposed to the steps below. I have finished but getting this error File “C:/Users/User/Desktop/question2.py”, line 37, in jobtype_salary[li[‘job’]] = int(li[‘salary’]) ValueError: invalid literal for int() with base 10: ‘SECRETARY a. Read the file into a lis…
How to generate more than one list from a list, using python functions
I am trying to make a 8 puzzle problem solver using different algorithms, such as BFS,DFS, A* etc. using python. For those who are not familiar with the problem, 8 puzzle problem is a game consisting of 3 rows and 3 columns. You can move the empty tile only horizontally or vertically, 0 represents the empty t…
Quit Python QR Scanner when no code is detected but keep running while processing the code
I’m creating a python script that scans QR codes, and then processes the info in the code. The python-script will launch every few seconds via a timer in systemd on RBPI, but while scanning for a code – if no code has been detected in 5 seconds, the script should terminate. However, if a code is d…
During recursive scraping in scrapy, how extract info from multiple nodes of parent url and associated children url together?
The parent url got multiple nodes (quotes), each parent node got child url (author info). I am facing trouble linking the quote to author info, due to asynchronous nature of scrapy? How can I fix this issue, here’s the code so far. Added # <— comment for easy spot. Please note that in order to …
How do I get random numbers that fully cover a range?
I’m trying to have random integers between (1,5) but the catch is displaying all of the values from the random integer in a for loop ranging of 10 loops. I only have access to randint() and random() methods in ‘random class’. Answer Based on clarifications in my other answer, I think you mea…
Python pandas conditional ffill. Fill the month beginning value till that month’s end
The code below produces sample dataframe The value on 1st of December is as follows Which outputs 9 My question is how to use “ffill” method to have this value 9 for all days of December? I want the month beginning value to be filled till end of that month Answer Replace values for all days except…
How to get parameter names from a parametrized string?
What I’d like is: I’ve looked through string.Template, it does only substitution. Is there a standard library way to do this? Because in case of regex, there would have to be a check if $smt is actually a valid Python variable name and so on. Answer string.Template, or one of its subclasses, store…
Why should the input_shape property of a Conv2D layer be specified only for the first Conv2D layer?
I am new to AI/ML stuff. I’m learning TensorFlow. In some tutorial, I noticed that the input_shape argument of a Conv2D layer was specified only for the first. Code looked kinda like this: In many examples, not only in the above, the instructor didn’t include that argument in there. Is there any r…
django foreign key mismatch – “question_question” referencing “question_subject”
Hi there is this problem I have can anyone solve this ? here is my django model and here is the error code and here is the subject model Answer This error is likely do to a migration issue. If you are in early development, the quickest solution is to delete migration files and SQLite db, re-run python manage.…
PyQt5 Python: How to go through Individual Row of Data from MySQL Query Result
I am trying to add item in a QComboBox in PyQt5 using Python. I am having problems in adding data from the SQL Query per row. This results to only a single item added into the Combo Box: What I want to happen in the ComboBox is like this (Add a total of 5 items in the Combo Box) Edit: