Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: comparing two lists
Post: RE: comparing two lists

I copied in the student_answers list again to make it easier. def main(): # Constant of correct test answers. CORRECT_ANSWERS = ["A", "C", "A", "A", "D", "B", "C", "A", ...
Siylo Homework 19 6,978 Jan-22-2019, 11:38 PM
    Thread: comparing two lists
Post: RE: comparing two lists

I do want the indexes, at the end I'm trying to print out a list of the incorrectly answered questions so question 1 == index 0. def main(): # Constant of correct test answers. CORRECT_ANSWERS...
Siylo Homework 19 6,978 Jan-22-2019, 10:01 PM
    Thread: comparing two lists
Post: RE: comparing two lists

Okay, so I was playing around and I have an error I don't know how to fix. def main(): # Constant of correct test answers. CORRECT_ANSWERS = ["A" , "C" , "A" , "A" , "D" , ...
Siylo Homework 19 6,978 Jan-22-2019, 09:03 PM
    Thread: comparing two lists
Post: RE: comparing two lists

So I spoke with my professor today and I see the disconnect now. I am in a Programming Logic and Object Oriented Design class and not a Python class. Python is the teaching medium that they are using ...
Siylo Homework 19 6,978 Jan-22-2019, 06:56 PM
    Thread: comparing two lists
Post: RE: comparing two lists

Okay, this is the finished product. def main(): CORRECT_ANSWERS = ["A" , "C" , "A" , "A" , "D" , "B" , "C" , "A" , "C" , "B" , "A" , "D" , "C" , "A" ,...
Siylo Homework 19 6,978 Jan-21-2019, 10:59 PM
    Thread: comparing two lists
Post: RE: comparing two lists

CORRECT_ANSWERS = ["A" , "C" , "A" , "A" , "D" , "B" , "C" , "A" , "C" , "B" , "A" , "D" , "C" , "A" , "D" , "C" , "B" , "B" , "D" , "A"] stu...
Siylo Homework 19 6,978 Jan-21-2019, 09:58 PM
    Thread: comparing two lists
Post: RE: comparing two lists

It is very tough on me because I like to search out the best or most efficient way to do something but in this class we are not allowed/rewarded for doing so. She seems to think if she didn't teach it...
Siylo Homework 19 6,978 Jan-21-2019, 09:27 PM
    Thread: comparing two lists
Post: RE: comparing two lists

How so? So I can avoid them in the future.
Siylo Homework 19 6,978 Jan-21-2019, 08:52 PM
    Thread: comparing two lists
Post: RE: comparing two lists

We haven't covered zip() in class yet so it can not be used.
Siylo Homework 19 6,978 Jan-21-2019, 07:31 PM
    Thread: comparing two lists
Post: comparing two lists

I am trying to compare two lists. The first list is a constant of "correct answers". The second list is the "answers from a student". How would I check each index of the students answers list against ...
Siylo Homework 19 6,978 Jan-21-2019, 07:20 PM
    Thread: why is this not filling my empty list?
Post: RE: why is this not filling my empty list?

Yes, it is part of a larger program. Yes, it is part of a function. I can not use random.choice because we have not used that in class. import random def main(): # creating empty list to read i...
Siylo Homework 4 3,157 Jan-21-2019, 05:27 PM
    Thread: why is this not filling my empty list?
Post: RE: why is this not filling my empty list?

So I pulled out the readline part of the code to read # creating empty list to read in file responses = [] file = open("8_Ball_responses.txt" , "r") for line in file: responses.a...
Siylo Homework 4 3,157 Jan-21-2019, 05:14 PM
    Thread: why is this not filling my empty list?
Post: why is this not filling my empty list?

Could someone tell me why this isn't filling my empty list? # creating empty list to read in file responses = [] file = open("8_Ball_responses.txt" , "r") for line in file: respo...
Siylo Homework 4 3,157 Jan-21-2019, 05:03 PM
    Thread: defining a function to see if a list is sorted
Post: RE: defining a function to see if a list is sorted

Thank you very much. I am going to save these in my notes. We haven't covered anything like this in class, it's a first programming class, but I like to play with new things and push the limits of wha...
Siylo Homework 14 6,990 Nov-29-2018, 05:11 PM
    Thread: defining a function to see if a list is sorted
Post: RE: defining a function to see if a list is sorted

If I back up my return True statement to fall in the same column as my for loop it still returns True. Shouldn't the if loop run for each value in the list per the for loop? I figured it out. Thank y...
Siylo Homework 14 6,990 Nov-29-2018, 12:34 PM
    Thread: defining a function to see if a list is sorted
Post: RE: defining a function to see if a list is sorted

There has to be an issue with where my return statement is because it is returning True even when the list is not sorted. def isSorted(list): previous_value = list[0] for value in list: ...
Siylo Homework 14 6,990 Nov-29-2018, 12:20 PM
    Thread: defining a function to see if a list is sorted
Post: RE: defining a function to see if a list is sorted

How do I compare a value against the previous value in the list? When I use the code, that is posted above this post, it returns false even if the list is a sorted list. We haven't gone over enumerate...
Siylo Homework 14 6,990 Nov-29-2018, 12:05 PM
    Thread: defining a function to see if a list is sorted
Post: RE: defining a function to see if a list is sorted

I can't. It is a specific homework project. The project is as stated, define a function called isSorted, that takes a list as an assignment, that will return True if the list is sorted and False if it...
Siylo Homework 14 6,990 Nov-29-2018, 04:02 AM
    Thread: defining a function to see if a list is sorted
Post: defining a function to see if a list is sorted

I am trying to define a function called isSorted that should take a list as an argument an return True if it is sorted and False if it is not sorted. I've tried to look up videos for help and haven't ...
Siylo Homework 14 6,990 Nov-29-2018, 02:06 AM
    Thread: searching file for unique words
Post: searching file for unique words

I am a new programmer looking to write a program that will search a .txt file and print out the unique words in it. Are there any built in functions that can help with this?
Siylo General Coding Help 2 2,530 Nov-20-2018, 04:57 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020