Hi I am new to Python. I am stuck on this question..... I know it is only simple but it just will not work for me and I have spent hours looking at the screen.. :(
below is some code. The first fuction is to simply return the average rating of the video and a count.... I thought I did this right as when I create a separate shell that links to the database it provides the average and the count. (number of ratings added to the database)...
User Profile
Collapse
-
New to Python, can you please help with a question??
-
oh sorry i get confused with the terminology.. Ive worked it out anyway :) but thanks for trying to help! -
it just says filename.exe has stopped working. Windows can check online for a solution to the problem.
so there is no syntax error being shown. could i possibly be going out of bounds???
originally I tried to use this code to sort it but it didnt seem to work!
while(!list)
{
WordNode *tempNode = new WordNode;
tempNode->word=word;
...Leave a comment:
-
yes I will have to do that too.. I'm only new to this :) will get the errors...Leave a comment:
-
sorting linked list in alphabetical order HELP!
I'm confused as to why this isnt working.. am i doing this right?? I have to create a function that does the following:
- Insert a word to the linked list so that the list
// remains sorted alphabetically.
// PRE: The list is sorted alphabetically or is NULL
// POST: The resulting list is sorted alphabetically. If the word is
// in the list already, do nothing.
struct WordNode... -
does anyone have any ideas I'm stuck on comparing the two strings..
Basically I have one string and a vector of characters.
I have sorted both in ascending order. basically I need to output the string if all of the characters in it match some or all of the characters from the vector.
eg
vector characters is airport
string is
airport
output airport
or vector characters is airport
...Leave a comment:
-
ok dont worry about the previous thread. I managed towork it out... it has taken me a while.. but I am getting there and it is helping me to understand it all..
Now I am stuck on a merge sort.. I think I might give myself a break for the night after I post this as I have been working on it for hours.........
okay so I have sorted each character vector into ascending order and now I need to merge them. well sort of.....Leave a comment:
-
okay so now I am trying to work out in my assignment on how to output each character in a string... I understand what I am doing wrong in this but I am not sure how to make it right??
string c;
for (int i = 0; i < wordList.size() ; i++)
{
c = wordList.at(i);
for (int j = 0; j < c.length(); j++)
{
int sum =...Leave a comment:
-
No I'm using bloodshed dev c++. I got everything I was asking sorted out. although I kind of made it manual by getting it to read in the exact number of words in the file.. I was stuck on how to change it.....
Anyway now I'm onto the harder stuff... but I dont think I will work on it today. I will probably have a few questions where I am stuck but I want to see if I can do it on my own :-)Leave a comment:
-
-
ok my next question is about calling a function into the test.cpp file... for some reason a different function is not working. Am I calling it wrong?????
I
int main()
{
string fname;
cout << "\t Welcome to Target Helper \n\n";
target t; // create a new target object
char choice = ' ';
while (choice != 'Q')
{
printMenu();...Leave a comment:
-
ok I worked it out.. although it is a little manual :) so dont worry about answering the previous question... YAY I did something on my own :)Leave a comment:
-
You guys are all so helpful :) But me being me keeps confusing myself. I know it is probably such a simple thing to do...
I did a test doing the following
for (int i = 0; i <= 100;i++)
{
infile >> data;
cout << data << endl;
}
cout << "this is data outside the loop " << data;
When...Leave a comment:
-
Okay I just realised I am still doing it wrong. I need to obviously open dict.txt which I am now doing but it is reading into int data. I need it to read words into vector wordList.... how would I do that??? I have tried changing the part that says string data to vector<string> wordList but it doesnt like what I am doing?? any ideas? :-)
target :: target()
// default constructor
// Opens small default...Leave a comment:
-
THank you :-) I didnt even think of that.. I got the first part to work .. or so it seems. it is at least compiling now... I really really appreciate it!!Leave a comment:
-
when I make it the file name.. eg.
target :: target()
// default constructor
// Opens small default dictionary ("dict.txt") and reads words into
// vector wordList
// Default dictionary contains only lower case words of length 4-9
// Sets centreLetter and otherLetters to spaces.
{
ifstream infile;
string fname;
int data;...Leave a comment:
-
reading txt file into class and inputting into a vector
Hi everyone. I am just starting out on my assignment on classes. We havent long learnt about them so I am struggling a little on how to do the following.
Below is a small part of the definition of the class.. I have not provided all of it as I dont have questions on the rest of it.... I was wondering how I am supposed to open a txt file in the class constructor target....
Code:class target { // Definition
-
ah no it is a very very long code. But what you guys mentioned did help my understanding. I just have to be careful that I dont start using codes that I have not learnt yet. We only started learning vectors last night!! They supposedly are going to replace arrays for the rest of our course this semester.. And we only really started on classes too.
It definately needs a lot of work but it was the only way that made any sense to me......Leave a comment:
-
i worked out the grids !! yaaaaaaay thanks everyone for ur help !!Leave a comment:
-
ok.. I am getting myself confused....
I understand I need to check the following..
for minigrid 1
00 01 02 10 11 12 20 21 22
minigrid 2
03 04 05 13 14 15 23 24 25 and so on....
So I know that I need to come up with an array or something that can check each minigrid....Leave a comment:
No activity results to display
Show More
Leave a comment: