Questions tagged [pset6]

The problem set for Week 7

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

get_string function not working on pset6 2020

here is the problem ~/ $ python hello.py Traceback (most recent call last): File "/home/ubuntu/hello.py", line 1, in <module> answer = Get_string("what is your name") ...
0
votes
1answer
689 views

PSET6 DNA Sumbit50 not matching with usual output

Hello, After a lots of effort I was finally able to implement DNA and it works correctly ! but Submit50 shows correct output for text file (1-5) but incorrect for rest The text file which have ...
0
votes
0answers
12 views

Pset6 Readability Python: no output

from cs50 import get_string, get_int import sys def main(): statement = get_string("Text: ") count = len(statement) no_words = count_words(statement) no_letters = ...
0
votes
1answer
131 views

pset6 mario/more - output is seemingly correct, however failing tests

I've just finished mario/more in pset6, however, it does not pass the tests. The actual and expected outputs are identical, so is the expected string. The pyramid also looks identical to the c ...
0
votes
1answer
186 views

PSET 6 DNA: How to get number of repeats for each value of STR's? [SPOILER: Full code]

I have written a code to count the highest number of consecutive repeats of specific DNA substring sequences in a long string of DNA...or so I thought. While my code can correctly count the longest ...
0
votes
1answer
18 views

Pset6 - DNA - Strange Error

I'm in the [ Testing ] section and my program works fine with [ small.csv ], but the expected data is not the same as the real data: For example: If I run this: python dna.py databases/large.csv ...
0
votes
1answer
38 views

Starting pset6, sentiments

I'm really not completely understanding how to get started on sentiments. I think I need to load the positive and negative words into the memory of analyze, but I don't really understand how I go ...
1
vote
1answer
665 views

PSET 6 DNA - PROBLEM COUNTING CONSECUTIVE STR SEQUENCES

Im struggling with the PSET6 DNA solution. So far I have opened the dna file and converted it into a dictionary as well as reading the text file. I'm trying to count the consecutive times an STR ...
0
votes
1answer
39 views

Changing directory to vhost

I'm trying to do the basic "hello, world" HTML site in week 7 of CS50, and I don't know how to change my directory. In the example, his directory looks like (~/vhosts/localhost/public) however my ...
0
votes
1answer
20 views

Index to integer

How do i convert an index to an integer? I tried int(index), that didnt work. For example; S = [a,b,c,d] For index in S: n = int(index) print (n) break print ()
0
votes
1answer
204 views

Pset 6 DNA: improving efficiency

I've successfully submitted the below code on Pset6 for the DNA problem. But, I know my 'get_longest' function is a horror show as far as efficiency is concerned: I am doing a series of checks that I ...
0
votes
1answer
64 views

Issue with recording STRs in memory (PSET6 - DNA)

I'm trying to record the number of repetitions of each str in the sequence. I created a dictionary as below and another empty dict because i couldn't update a dict while iterating through it. But for ...
0
votes
1answer
168 views

Pset6 DNA Not matching to names in the database

The print statements seem to turn out what I hoped for up until trying to compare the STR counts to the database STR counts. I would just appreciate any pointers of where I'm going wrong thanks. ...
0
votes
1answer
206 views

can't get my readability program to work on all conditions- rounding issue?

My python readability program is not giving me the correct grade level for all of the checkers. specifically: "In my younger and more vulnerable years my father gave me some advice that I've been ...
0
votes
1answer
37 views

pset6 301 moved permanently error

Here are my implemented functions const char* lookup(const char* path) { char ext[6]; int j = 0; for(int i=0,n=strlen(path);i<n;i++) { if(path[i]=='.') { ext[j] = path[i]; ...
0
votes
1answer
1k 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
32 views

Using open.readlines, why won't it return the list?

My understanding of this part of sentiments is that I need to open the positive words file and make it all into a list, I thought I could do this with open.readlines, but it isn't working. Can someone ...
0
votes
2answers
107 views

cs50 pset6 takes too long to run

I am trying to improve my code for pset6, it works but currently takes a few minutes for the larges files. Can I get some help as to how to improve performance? from sys import argv, exit import csv ...
0
votes
1answer
53 views

After implementing parse, should all checks be green?

I am working on pset6, after implementing parse(), we are instructed to use check50. check50 2015.fall.pset6.server1 server.c At this point, I haven't done any code for query, load() or indexes(). ...
0
votes
1answer
59 views

DNA pset6 My code works fine in small csv, but not large (Spoiler)

The problem happens with the count when i try to count STRs, it counts some str right and some wrong, which is strange for me, and when i deal with small csv all works fine. can someone help me in ...
1
vote
1answer
52 views

PSET 6 Similarities no display from log

I am working on the PSET6 more. My code passes the check50, and it displays the comparing table in the website. However, nothing is showing up for the log operations. I have around for answers but I ...
0
votes
1answer
29 views

pset6 three errors and i don't know why

in my work when i try ./server it show me stopping server then i use printf in start function to know what wrong and i know if i type ./server puplic start function in root=realpath(path,NULL) show ...
0
votes
1answer
40 views

PSET6 DNA Almost done - matching not working correctly

I have been stuck with last part of the code that is supposed to match the DNA sequence from sequence.txt with the one in database.csv. It passes most of the tests in check50 and fails only in ...
0
votes
1answer
29 views

pset6 parse function fails “hello.php?” test

My code passes all but 1 test. This is the error: :( Requesting hello.php? returns 200, text/html, and correct output \ expected output, not an exit code of 0 Can you see what the problem is?? ...
0
votes
1answer
29 views

Pset6 Cs50 = Readability false output

I have been trying to complete readability python but on every result it is showing before Grade one from cs50 import get_string s = get_string("Text: ").strip() num_letters, num_sentences,...
0
votes
1answer
32 views

Pset 6 - Readability printing one grade off

I managed to translate readability from C to python, except it is printing one grade lower than what it is supposed to when testing. What am I missing here? """ 1) Ask user for phrase 2)...
0
votes
1answer
351 views

PSET 6 DNA.py wrong output [spoiler]

I am a beginner in cs50 and I have a problem with the DNA problem that gives the wrong result for most of the queries. I wonder if anyone could point where is the mistake. ie. python dna.py databases/...
1
vote
1answer
33 views

DNA: Excluding a column from my dict iteration

Logic: I'm trying to do this in such a way that I check the database first, then I check the DNA sequence to see if that information corresponds to any of the information in my database. I want to ...
0
votes
1answer
36 views

Load function implementation check - pset 6 (server.c)

bool load(FILE* file, BYTE** content, size_t* length) { char* data = malloc(sizeof(BYTE)); int i = 0; while ((data[i] = fgetc(file)) != EOF) { i++; data = realloc(data, (sizeof(BYTE) * i) );...
0
votes
1answer
28 views

pset6 sentiments init help

I just started working on the sentiments, at the moment I'm loading the positive words into a list and printing them out at a test. I'm having trouble with the for loops for getting each word into the ...
0
votes
1answer
213 views

My DNA code works with the small database but not the large one

My code works perfectly fine with the small database but gives "No Match" for the large one and I can't figure out why. Any help would be appreciated! import csv from sys import argv, exit def main()...
0
votes
1answer
32 views

Pset6 Vigenere.py

For Pset6 Python, Vigenere.py does not encrypt any message with any key. It only prints out the given plaintext, not encrypted. Any help would be greatly appreciated. Thanks in advance. Code: #...
0
votes
1answer
56 views

pset6- - greedy not printing, just returns the input! Please, help

import cs50 while True: print ("O! Hail!, How Much Change Is Owed?") n = cs50.get_float() if n >= 0: break q = 25 q1 = 0 d = 10 d1= 0 ni = 5 ni1 = ...
0
votes
2answers
40 views

How do you delete a line depending on its first character?

When trying to delete all of the comments in positive-words.txt I have tried iterating over the lines and checking if the line startswith ';' however I do not know how to delete the line if it does. ...
0
votes
1answer
41 views

Pset6 analyzer getting positive words from text and turning them into a string

I'm trying to get the analyzer function to work and I'm really just not fully understanding what to do and how to do it. I think I need to take each line of the text files and have put into a string. ...
0
votes
0answers
11 views

Problem with pset6 readability.py

It showing that one test failing. expected "Grade 8\n", not "Grade 7\n" After I'm going to results page, copy the text they use in test and manually testing it in my console, The ...
0
votes
1answer
178 views

Problem Set 6 CS50 2017 Caesar Issue TypeError: 'str' object does not support item assignment

As the title suggests, when I tried to run my current code for Caesar.py, I got the error message "TypeError: 'str' object does not support item assignment" from the interpreter. My code is like this:...
0
votes
1answer
206 views

Pset6 DNA help - trouble calculating STR repeats with long database

I have really tried to just solve this one myself but after a few weeks this seems futile without guidance. I am having trouble getting a for loop to calculate the maximum consecutive occurrences of ...
0
votes
1answer
45 views

Why might my parse return seg.fault to check50?

Below is my parse function in server.c pset6; The code is not fully commented yet, my bad; Nonetheless, why are all exit code 0 in check50, where is the loophole? Thank you. bool parse(const char* ...
0
votes
1answer
40 views

analyzer.py cant store string in my dictionary

For some reason when i run the following python code I get the following error: Traceback (most recent call last): File "/home/ubuntu/workspace/pset6/sentiments/analyzer.py", line 20, in init ...
0
votes
1answer
69 views

What is if __name__ == “__main__”: doing in compare pset6?

I read the documentation, but I still can't pinpoint exactly what it is this line of code is doing in compare. The code of compare is as follows: #!/usr/bin/env python3 import argparse import re ...
0
votes
1answer
104 views

Else is ruining my code in dna and I don't get why

I'm trying to record the longest run of each STR I need and I'm close. Without the final "else" the code works fine with small dictionary and almost fine with long (because the count I ...
0
votes
1answer
61 views

Pset6 Parse Errors in Check50

bool parse(const char* line, char* abs_path, char* query) { const char* sp1 = strchr(line, ' '); const char* sp2 = strrchr(line, ' '); const char* slash = "/"; const char* crlf = ...
0
votes
1answer
256 views

pset6 load seg faulting when accessing malloc'd node

I need some guidance on where I'm going wrong here. GDB runs fine until I try to access the "next" property of a node to see if it's NULL. Am I just confusing how the node structure works? My ...
0
votes
1answer
75 views

In pset6, have an error right from the start with mario.py

Here is my code so far in its entirety: import cs50 def main(): I immediately had an error (red dot with x next to def main): unexpected EOF while parsing I like that python notifies right away ...
0
votes
1answer
45 views

PSET6: Question with Mallocing char* for PARSE

I'm currently working on PSET6 and had a question for the parsing section. I decided to use strtok() and as a result, will need to malloc memory when creating new char*. How do i know how much memory ...
0
votes
1answer
72 views

Load and server not working, am confused

Am really trying to solve server.c though I don't really understand the specification for load and indexes functions. My parse and lookup seems to be working well, they passed check50 for server1 ...
0
votes
1answer
93 views

Pset6 how to remove http/1.1 from request line

Really stuck on pset6, all I want to do is subtract http/1.1 from the request target and nothing I've tried seems to work. Does anyone know any pseudo code I could follow for this? I can move the ...
0
votes
1answer
239 views

Struggling with PSET6 DNA

I've been doing this for quite some time now, but I'm struggling to get the appropriate output. In the below code (which is incomplete as of now, but the main pieces are all on the board), I'm not ...
0
votes
1answer
80 views

Problem with parse function

When i run Check50 (server1) , It shows me the following errors AFTER EDIT : :( HTTP/1.0 returns error code 505 \ expected output, but not "HTTP/1.1 404 Not Found\r\nContent-Type:..." :( ...

1
2 3 4 5
17