Questions tagged [pset6]

The problem set for Week 7

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

PSET6 DNA Why is my (count consecutive substrings in string) function always returns 0's?

I tried writing different function variations but my count_dna function keeps returning zeroes (despite having consecutive sequences of STRs in the dna sequences)--can anyone please tell me why? Note: ...
0
votes
2answers
25 views

PSET6 Readability "unsupported operand type(s) for *: 'float' and 'NoneType'"

I'm getting "unsupported operand type(s) for *: 'float' and 'NoneType'" error for line 34: "s = (100 / words) * sentences". Not sure what to make of this since count_sentences(text)...
0
votes
0answers
31 views

There is something wrong with the DNA file

I am doing Problem Set 6 DNA. And it looks like the data given to me in the large file is incorrect. When I am running my code with small file it works fine. But when I run with large file it is not ...
0
votes
0answers
22 views

My DNA program is showing me this error repeatedly

The error is written below: Traceback (most recent call last): File "/home/ubuntu/pset/pset6/dna/dna.py", line 54, in <module> main() File "/home/ubuntu/pset/pset6/dna/dna....
0
votes
0answers
15 views

Pset6 [DNA] . Works when I check by hand, but doesn't correctly identify names with check50.(doesn't return anything)

import sys import csv def main(): if len(sys.argv) != 3: print("Should be 3 command-line arguments ") sys.exit(1) with open(sys.argv[2], 'r') as f: for line ...
0
votes
1answer
37 views

What does "consecutively" mean in pset6 DNA?

I am working on pset6 DNA and I'm not sure I understand the terms of the problem. The objective is to write a program that matches a DNA sequence to a person in a DNA database based on the largest ...
0
votes
1answer
33 views

PSET6 - Readability. When I am running my program it is showing me this error again and again

The error I am getting Traceback (most recent call last): File "/home/ubuntu/pset/pset6/readability/readability.py", line 46, in <module> main() File "/home/ubuntu/pset/pset6/...
1
vote
1answer
59 views

How should rounding be handled in pset6 readability?

I'm struggling to understand what sort of rounding needs to be implemented to produce the grade in [pset6 readability][1]. For the Harry Potter extract provided ("Harry Potter was a highly ...
0
votes
1answer
17 views

My program is not is not able to import strlen from string.h

I am working on problem set 6 - Readability (python). When I am compiling my code the following error keeps coming. Traceback (most recent call last): File "/home/ubuntu/pset/pset6/readability/...
0
votes
0answers
29 views

Code Pset6 - DNA fails: no result at all

Can anyone please give me a hint? I've been working on my code for days now and I don't have a clue how to fix it. My code is included below. import csv from sys import argv, exit #initialize ...
0
votes
1answer
44 views

My program is not working

I am working on pset6 Mario. When I am running my program it is showing me some errors. But I think my code is correct. Here is my code: from cs50 import get_int row = 0 space = 0 insert = 0 ...
0
votes
0answers
19 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
70 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
0answers
14 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
66 views

Credit Card Check

So I am on pset6 trying to implement the credit card check. I've already completed working through the numbers and am not having any issue with the actual algorithm. But for some reason my if ...
0
votes
0answers
24 views

PSET6 Credit Regex Error

I have attempted to use regex matching to solve the credit problem, but I am encountering the problem of syntax error when trying to run my code. The regex.match function I tried to use was found from ...
0
votes
1answer
65 views

DNA Max Sequence Bug | Working on small.csv but not on large.csv

This is the complete code: """ - open csv file and sequence , read contents - for each str, compute longest chain - compare str counts aganist ech row in csv file """...
1
vote
1answer
41 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
78 views

Pset 6 - Dna - My outputs are slightly incorrect. Could someone help me figure out what might be the problem here?

I've been stuck on this question for a week. After countless hours of debugs, I decided to post it here. Please refer to images and code snippets below and kindly explain to me what might be the ...
0
votes
1answer
77 views

Minor change in pset6/dna required, need some help or hint

I am really really close to completing pset/dna. But there seems to be some problem in the 'if statement'. Somebody please guide. Before the line of underscores in the terminal, I have printed the ...
0
votes
1answer
72 views

pset6 DNA // having problem comparing elements from the database and the sequence file

Hi there I am having an issue comparing the data I have extracted from the sequence and the database files for now I am doing a sort of in efficient way but later I will fix it I am not sure really ...
0
votes
1answer
92 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
56 views

PSET6 DNA Think I'm getting an infinite loop which is apparent when testing with every txt file after 4.txt

Hi all I'm having trouble for PSET6 DNA. My code works fine for everything up until and including 4.txt but whenever I go to check the large.csv file and thus 5.txt, 6.txt, 7.txt and so on I seem to ...
0
votes
1answer
37 views

Imprecision during float subtraction in python

During pset6/cash, I tried to write the python code without multiplying change by 100 to get cents (as I had in c). I had assumed that this wouldn't lead to any precision issues, however when ...
0
votes
1answer
64 views

pset6 DNA works with small database but not with the large one

For some reason, when counting the times a substring repeats within a string (a STR in a DNA), my code fails with the large database. It is not a matter of overlapping sequences, because the numbers ...
0
votes
1answer
72 views

pset6 - DNA - works for small.csv but not large.csv

import csv import sys with open(sys.argv[1], 'r') as file: # stores data from small.csv in both dict and list form dna_names_dict = csv.DictReader(file) ...
0
votes
1answer
27 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
65 views

Mario (less) PSET6 Python Spacing help

Slightly embarrassed to be posting this as I could succesfully complete mario(less) in pset1 but apparently cannot replicate it in Python. My code is as follows: h = int(input("h: ")) # get ...
0
votes
1answer
28 views

pset6 mario more - there is a extra line in my output how do i get rid of it

o = input("Height: ") if int(o) > 8 or int(o) <= 0: o = input("Height: ",end = "") i = int(o) for j in range (i + 1): # calculating number of spaces n ...
0
votes
1answer
21 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
35 views

Pset6 Readability wrong Grade [duplicate]

Adjusted code to see how many letters, sentences and words counted. Noticed word count is lesser by one from cs50 import get_string text = get_string("Text: ") letter = 0 word = 0 ...
0
votes
0answers
88 views

pset6 dna question regarding searching string for substring, two types of code give different output

I am currently following along ayoutube tutorial for pset 6 DNA, and have a small question regarding a specific function. In this function, it basically takes a substring and a string, and counts the ...
0
votes
1answer
57 views

pset6 credit help with calculations in python

I am trying to convert my credit solution from C to python, but for some reason it is not working. Attached is my code and the problems from cs50 import get_int card, a, m, v = False, False, False, ...
0
votes
1answer
95 views

Getting ONE error on check50 for DNA - ValueError: max() arg is an empty sequence - Where is the bug?

I'm so close the finish line, but I get error on one out of the 21 CS50 tests. The test that is generating the error is number #2, which is: python dna.py databases/small.csv sequences/2.txt And I ...
0
votes
1answer
53 views

DNA - Getting the highest key value from a defaultdict

I have come a bit on DNA and have managed to write an algorithm for adding the number of matches in the sequence to a defaultdict. But I'm having problems with how to get the maximum value from the ...
0
votes
1answer
62 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
47 views

PSET6 - Readability: false grade output

from cs50 import get_string text = get_string("Text: ") letters = sentences = i = words = 0 length = len(text) while i < length: if text[i].isalpha(): letters += 1 //...
0
votes
1answer
42 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
53 views

check50 gives different output than my own for "18.txt" sequence. All others pass. Any thoughts/suggestions are appreciated

from sys import argv import csv import re # Only run if argc is 3 if len(argv) == 3: STRs = ["AGATC", "TTTTTTCT", "TCTAG", "GATA", "TATC", "...
0
votes
0answers
84 views

CS50 PSET 6 DNA Just Returns First Name

I've been working on DNA for a while now and thought I was done, but there's a problem with my code. Everytime I run it, the program just prints the first name on the database, so either 'Albus' or '...
0
votes
1answer
147 views

PSET 6 DNA - Computing STRs

I am trying to compute the most repeated STR for each sequence in a dictionary called str_dict. # compute STRs i = 0 # stablish length of the sequence length_seq = len(sequence) # iterate through all ...
0
votes
1answer
66 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 ...
0
votes
1answer
46 views

Print keys of CSV files in DNA pset6

I want to see what the keys of the reader dictionary are so I use the print(key) function. The result is all the lines of the dictionary. Why is that? import csv from sys import argv, exit # Check if ...
0
votes
1answer
55 views

Pset6 mario more didn't pass the test

I run through my code many times and didn't find anything wrong with it but the result printed out wasn't right: from cs50 import get_int while True: height = get_int("How high is the pyramid?...
0
votes
1answer
92 views

Computing consecutive STR is sometimes off by a little (Spoiler!)

My code works fine for the small csv file; however, when I get to the big csv file, my counts for the number of consecutive STR are less than the actual value by about 1 or 2. Here is my code: import ...
0
votes
1answer
240 views

Count the number of spaces in a string in python

I was trying to figure out how to calculate the number of spaces in a string when i came across this code online. Can someone please explain it? text = get_string("Enter Text: ") spaces = ...
0
votes
1answer
138 views

pset6 count STR in the DNA sequence issues

so i m a bit confused...i have been testing my code using the small database and what i have so far produced what i expected .... more specifically the STRcounts (i marked that part #?????). it is ...
0
votes
1answer
235 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
121 views

DNA: Errors in sequences.3 and 18.txt

I have worked hard on writing codes for DNA. Everything works except for sequences/18.txt, which returns "Harry" instead of "No match". The problem still exists in spite of several ...
0
votes
1answer
74 views

Pset6 Mario More

I submitted my code for Mario More in Python. Although it works properly by my own checks it gives me a 6/9 when submitted. from cs50 import get_int def main(): n = height() for i in range(n)...

1
2 3 4 5
17