Questions tagged [python]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
63 views

PSET6 - DNA - Code fails to compare STRs to DNA text file

I have updated my code after making a number of amendments but am still a bit stuck! I don't think my STR_check_count is working properly as it always seems to return 0s and I'm also not sure if I'm ...
0
votes
0answers
26 views

PSET8 CS50 Finance: /Check fails to run, does not catch or notify of duplicate usernames

I have been struggling with the check function in PSET8 for a few weeks now, and have run into various problems as I tried to work through my issues. Currently, it seems by check .get function does ...
0
votes
1answer
58 views

PSET6 DNA How to read each value in the CSV file?

In PSET6 DNA, I have to read the CSV file. I use with open("P:\Code\Python\dna\databases\small.csv") as csvfile: #open on my PC dna_db = csv.DictReader(csvfile) for row in dna_db: ...
0
votes
1answer
93 views

PSET 6 - DNA - How to pass only value in python

~~~python import csv import sys import copy dbPath = sys.argv[1] seqPath = sys.argv[2] if len(sys.argv) > 3: print("error") exit() str_list = [] DB = open(dbPath, 'r') DBreader = csv....
0
votes
1answer
19 views

speech recognition dosen't work

when following the CS50 course of Python, I tried to do the Speech recognition as David did, but the program fails. I have installed SpeechRecognition and Pyaudio as well througn pip install. Here is ...
1
vote
1answer
15 views

Iterate over a list of dicts and get key value pair of specific keys

I'm trying to iterate over a list of dicts and get only the symbol and company name out of it maybe store in another dict, I tried parsing the json file directly and failed. I tried searching all the ...
1
vote
2answers
64 views

Can't create table from postgresql through sqlalchemy in python

I am working on project 1 of python and javascript web programming and have no clue why it just can't create table. The coding execute without returning any error. Below is the code and I really ...
0
votes
1answer
44 views

Finance: Can not Update and Insert to SQL

In my buy function I cant INSERT or UPDATE data in SQL. RuntimeError: (sqlite3.OperationalError) near "ON": syntax error [SQL: INSERT INTO buy (share_name, share_symbol, share_price, shares, id) ...
0
votes
0answers
48 views

Survey, problem with sheet.html and post_form

I finish my survey, but still have some bug in it. In my post_form, if I use the writer.writerheader() before writer.writerow in my csv file all information writing like this: name,animals,power ...
0
votes
0answers
9 views

Trying to build an archive function for a student management app with Python and flask, need some help please

I have a list of active students which was added with a form. I'm now trying to add the ability to archive a child as soon as he/she's no longer active. I've been struggling with this for some time ...
0
votes
1answer
177 views

API Goodreads issue with the book page

I have been facing an issue with the API, it does not display in the book page in project1 I keep getting the error "Not Found" could someone help me? Check the screenshots of the python code below, ...
1
vote
0answers
67 views

Seding email with python smtplib

For the final project, I'm creating a website that will send a form's of the website to an email address. I'm using flask in python and smtplib in the CS50 IDE. I receive the following error ...
0
votes
1answer
21 views

Caesar in Python

On cs50 IDE, for problem set 6 Caesar, it keeps saying my program is wrong and giving me a 37% but it compiles perfectly. I checked with check50 and everything it say's it doesn't do it does precisely....
0
votes
1answer
27 views

Case sensitivity of keyword in pset 6 Python Vigenere

I've been stuck on Vigenere in pset6 for a few days now, and I've finally got it. It somehow took me longer to do Vigenere in Python than in C, interestingly. But, I'm confused about one thing: why do ...
0
votes
0answers
14 views

Python imports does'n work

[![ Hi, working on my final project i am getting this error, and because of that i cannot use any library, does anybody know what's going on ?
0
votes
1answer
22 views

Final project (very similar to Finance) : How can I delete selected row of table?

In mynote.html, there is a table of words. It is very similar to history.html or index.html of Finance (pset8). I want to upgrade it for my final project, so I tried to make 'delete'. But, there is a ...
0
votes
1answer
92 views

Pset8 Finance problems with SQLite inserting into a table

Inserting into a table in finance.db fails. I'm able to run the sqlite3 command via cli without errors and populate the table with the debugging snippet command: INSERT INTO history (date, symbol, ...
0
votes
1answer
30 views

pset8 New errors without changing any old code [duplicate]

I've been working hard on pset8 lately and making great progress. I was busy and didn't get to work on it for about a week. I'm now getting errors that I didn't get before, and as far as I'm aware, I ...
0
votes
1answer
66 views

Stuck on Caesar, analyzing command line arguments

I've posted my code blow. I'm supposed to check if the 2nd command line argument (the key) is an number or not, and if it is, print it out as an integer. I'm having two issues: I get an error ...
0
votes
2answers
38 views

How to pass value from HTML to python?

I'm setting up a new project in python ,and want to setting up a web pageresturant.html using FLASK , this code in html get the selected value from drop down box when button is clicked ,how can i pass ...
0
votes
1answer
69 views

PSET 6 [Similarities - less] How is the compare file accessed in this problem since it is not imported to application.py

(Dont be intimidated by length of code chunks, I included all of my guess as to what's going on, so most of it is just stuff to skim over) The folder similarities contains static and template folders ...
0
votes
1answer
122 views

Cannot run Flask - TypeError

Whenever I try "flask run" I get this error in the IDE. I have no idea what the problem actually is. ~/workspace/pset7/survey/ $ flask run * Serving Flask app "application.py" (lazy loading) * ...
0
votes
1answer
87 views

python pset1 cash problem

Trying to solve pset1 cash less comfortale with python. Whats my mistake as I cant figure it out. Lets say I add 5.16 as cash owed that is 20*0.25+1*0.1 +1*0.05 +1*0.01 , 23 coins total used. ...
0
votes
2answers
1k views

Instance of 'scoped_session' has no 'commit' member

I'm working on the project1 from cs50web course. Getting the following problem using flask and SQLAlchemy: "Instance of 'scoped_session' has no 'execute' memberpylint(no-member)". I use Ubuntu 18....
0
votes
0answers
35 views

not supported between instances of 'tuple' and 'float' podrían decirme por que sale este error en este alforitmo?

not supported between instances of 'tuple' and 'float' podrían decirme por que sale este error en este alforitmo? def mayor(): diccionario=dict() archivo=open("datos.csv","r") print("...
1
vote
1answer
190 views

pset 7 survey: trying to redirect to /sheet returns invalid syntax error

For part of CS50's survey problem from pset7, I'm supposed to redirect from a route that checks if the user has entered in all the survey's fields / appends the values to a csv file --> a route that ...
0
votes
1answer
162 views

CS50 Bleep Incorrect Output

I am encountering a problem in CS50 Bleep. When censoring the message, the censored message consists of only one * for the entire word, rather than the length of the word. Here is my code: from cs50 ...
0
votes
1answer
91 views

PSET 6: Sentimental [Mario.py(less)]: How exactly do I “reject input” in Python as specified in check50?

this is my first time posting on here and I'm trying to not break any rules but sorry if I do. So, I followed the specification to make mario.py ( they are the same ones for mario.c ) in Sentimental ...
0
votes
1answer
32 views

CS50 finance/sell: DB not updating cash

I am currently working on the finance assignment however I am facing some difficulties updating the cash variable into my users database. All other database updates work fine but when it tries to ...
0
votes
1answer
144 views

CS50 Pset6: cash.py not returning number of coins used for change

Below is my code for pset6 of CS50, in which the user is prompted for an amount of change in the form of a float, which is converted into cents (e.g. 1.25->125), and the fewest coins needed to make ...
0
votes
1answer
70 views

Pset6 credit python Problem

I try to convert my Credit Solution from C to Python now. But on Line 19 ( doubleCheck = ccNumber[i] * 2 ) i always get the error "TypeError: 'int' object is not subscriptable"! How can i fix this? ...
0
votes
1answer
203 views

pset6 bleep: Problem with difference between list and string

I assume that I have the following problem: I create a list for the banned words and although a list with the text input. Then I want to compare both list. But when I create the list of the user ...
0
votes
0answers
146 views

Crack(python) very slow

from sys import argv from crypt import crypt from string import ascii_letters from itertools import product if len(argv) != 2: print("Incorrect number of arguments") exit() hashed_p = argv[1]...
0
votes
1answer
398 views

AttributeError: __enter__

I defined a table in python using sqlalchemy but when i try to create it this error appears
1
vote
1answer
410 views

PSET6 CRACK (python)

I'm stuck on Crack (in Python). I wrote the following code, which I think should cover every case, however it runs for hours without finding a solution. Any thoughts/advice are appreciated. from sys ...
0
votes
2answers
219 views

Can't Connect Python Flask With PSQL Database

every time i try to make connection between python and PSQL this error disappear ?
2
votes
1answer
257 views

CS50 Finance: Register unique username (/check) problem: pythion GET function not working

I am working on the new /check additional on the Finance problem. I am trying to prevent the register form from being submitted when the username is already taken, is empty, or is just one character. ...
0
votes
0answers
49 views

Issue with CS50W's Project2 - submitted text not passed to chat window

I have a problem regarding passing posted messages into the proper field and presenting them to the user. The app is supposed to transfer the text submitted in "messenger" into the "messages" so to ...
1
vote
1answer
69 views

pset7 similarities: c-style loop vs generator

I am working on the similarities helpers.py. On checking check50, I found that the generator below does not work as intended, where input is ('This is one. This is two. This is three. This is two. ...
1
vote
1answer
77 views

How to integrate handlebars(written in raw javascript) into django templates

Please, I'm still rather new to handlebars templating, my handlebars template works perfectly with just html files, but when I try to render the page containing the handlebars template, I get all sort ...
1
vote
1answer
69 views

problem with pset6 python credit

Below is my code: [hidden code] output is: Enter the card number: 378282246310005 firstTwo 37; firstOne 3; cardlen 15 MASTERCARD note: it shows MASTERCARD instead of AmEx..Why?
0
votes
1answer
36 views

PSET7 variable not defined for sql statement

This is a chunk of my code from buy: if total_cost <= cash_balance[0]["cash"]: user_id = session["user_id"] cash_remaining = cash_balance[0]["cash"] - total_cost #db....
1
vote
1answer
38 views

Python Caesar not working for mix case etc

I've pretty much gotten my program to work 90% successfully! But, it does not produce the correct outcome for mix case or spaces/symbols. I've tried a number of different methods to no avail. At the ...
0
votes
1answer
141 views

Final Project - Problem uploading files to IDE folder

Update: Does anyone know hot to get the folder's absolute path? It isn't ~/workspace/fp/documentos/ or any of it's variations, such as /workspace/fp/documentos/ or workspace/fp/documentos/. It seems ...
0
votes
1answer
15 views

Why can't I break out of this while loop in python 2.7?

I've used a very similar loop in the past and had no issues. Here is the code: while(1): # Read the file file = open("db.csv", "r") # Get a line from the file line = file.readline() ...
0
votes
1answer
22 views

PSET8 invalid sw.

When I am trying to use the search bar, the autofill just gives me " , , " and when I click on that suggestion the console tells me "invalid sw". After reasearching the problem a bit, everyone seems ...
1
vote
1answer
210 views

PSET6 Similarities (more) Could Not Read File1

I am working on the distance function in pset6 similarities (more comfortable). When I run ./score cat ate, it gives me the error "could not read cat". I copied my code to another tab to test out my ...
0
votes
1answer
62 views

Project 1 Stuck on WHERE clause for Searching Books

I am working on Project 1 for CS50W on EdX. I am building the book search Flask app. My problem is with building the SQL SELECT statement utilizing the WHERE clause depending on the search fields. I ...
0
votes
1answer
2k views

Unable to run Flask App using Anaconda Prompt.Do Anaconda support Flask?

I am using Anaconda for editing and running scripts. In Anaconda prompt/command prompt, when I type this command : export FLASK_APP=application.py I am getting the error: "'export' is not recognized ...
0
votes
0answers
37 views

Mario.py works but gets different check50 results each time without changing a thing in the source code

Can someone please point out what's wrong with my code? from cs50 import get_int def main(): print("Height should be a positive integer between 0 and 23.") # a "do-while" loop to recieve a ...