Answer:
import numpy as np
word = input("Enter a word: ")
acc = []
with open("Downloads/record-collection.txt", "r") as file:
lines = file.readlines()
for line in lines:
if word in line:
line = line.strip()
acc.append(int(line[0]))
if np.mean(acc) >= 2:
print(f"The word {word} is a positive word")
print(f"{word} appeared {len(acc)} times")
print(f"the review of the word {word} is {round(np.mean(acc), 2)}")
else:
print(f"the word {word} is a negative word with review\
{round(np.mean(acc), 2)}")
Explanation:
The python program gets the text from the review file, using the user input word to get the definition of reviews based on the word, whether positive or negative.
The program uses the 'with' keyword to open the file and created the acc variable to hold the reviews gotten. The mean of the acc is calculated with the numpy mean method and if the mean is equal to or greater than 2 it is a positive word, else negative.
What line of code makes the character pointer studentPointer point to the character variable userStudent?char userStudent = 'S';char* studentPointer;
Answer:
char* studentPointer = &userStudent;
Explanation:
Pointers in C are variables used to point to the location of another variable. To declare pointer, the data type must be specified (same as the variable it is pointing to), followed by an asterisk and then the name of the pointer. The reference of the target variable is also assigned to the pointer to allow direct changes from the pointer variable.
A series of gentle often open-ended inquiries that allow the client to progressively examine the assumptions and interpretations here she is made about the victimization experience is called:_____.
Answer:
Trauma Narrative
Explanation:
Given that Trauma narrative is a form of narrative or carefully designed strategy often used by psychologists to assists the survivors of trauma to understand the meaning or realization of their experiences. It is at the same time serves as a form of openness to recollections or memories considered to be painful.
Hence, A series of gentle often open-ended inquiries that allow the client to progressively examine the assumptions and interpretations he or she is made about the victimization experience is called TRAUMA NARRATIVE
Pointers are addresses and have a numerical value. You can print out the value of a pointer as cout << (unsigned)(p). Write a program to compare p, p + 1, q, and q + 1, where p is an int* and q is a double*. Explain the results.
Answer:
#include <iostream>
using namespace std;
int main() {
int i = 2;
double j = 3;
int *p = &i;
double *q = &j;
cout << "p = " << p << ", p+1 = " << p+1 << endl;
cout << "q = " << q << ", q+1 = " << q+1 << endl;
return 0;
}
Explanation:
In C++, pointers are variables or data types that hold the location of another variable in memory. It is denoted by asterisks in between the data type and pointer name during declaration.
The C++ source code above defines two pointers, "p" which is an integer pointer and "q", a double. The reference of the variables i and j are assigned to p and q respectively and the out of the pointers are the location of the i and j values in memory.