In Python please.
Alice travels a lot for her work. Each time she travels, she visits a single city before returning home.
Someone recently asked her "how many different cities have you visited for work?" Thankfully Alice has kept a log of her trips. Help Alice figure out the number of cities she has visited at least once.
Input:
The first line of input contains a single positive integer T <_ 50 indicating the number of test cases. The first line of each test case also contains a single positive integer n indicating the number of work trips Alice has taken so far. The following n lines describe these trips. The ith such line simply contains the name of the city Alice visited on her i th trip.
Alice's work only sends her to cities with simple names: city names only contain lowercase letters, have at least one letter, and do not contain spaces.
The number of trips is at most 100 and no city name contains more than 20 characters.
Output:
For each test case, simply output a single line containing a single integer that is the number of distinct cities that Alice has visited on her work trips.

Answers

Answer 1

Answer:

Explanation:

We have the following

t is the number of test cases.

n is the number of trips for each testcase

name is the name of the city

all the unique names are added to the list and at last the length of the list is printed.

The program is written as follows

t = int(input) - for i in range(t): n = int(input) 1 = [] for j in range(n): name = input if name not in l: 1.append(name) pr

t = int(input())

for i in range(t):

n = int(input())

l = []

for j in range(n):

name = input()

if name not in l:

l.append(name)

 

print(len(l))

Output:

In Python Please.Alice Travels A Lot For Her Work. Each Time She Travels, She Visits A Single City Before
Answer 2

The program illustrates the use of lists.

Lists in Python are used to store several values on one variable.

The program written in Python where comments are used to explain each line is as follows

#This gets input for the number of test cases

T = int(input())

#This iterates through the test cases

for i in range(T):

   #This gets input for n; the number of work trips

   n = int(input())

   #This creates a list of the cities visited

   city = []

   #This iterates through the work trips

   for j in range(n):

       #This gets the name of the city

       name = input()

       #For names not in the list of city

       if name not in city:

           #The city is appended to the city list

           city.append(name)

#This prints the number of cities

print(len(city))

Read more about Python lists at:

https://brainly.com/question/24941798


Related Questions

Write a program that will ask for the user to input a filename of a text file that contains an unknown number of integers. And also an output filename to display results. You will read all of the integers from the input file, and store them in an array. (You may need to read all the values in the file once just to get the total count) Using this array you will find the max number, min number, average value, and standard deviation. These results will be reported to both the screen and placed into the output file that the user choose. Output to screen and file could look like this: Read from file: 12 values Maximum value

Answers

Answer: Provided in the explanation section

Explanation:

Code provided below in a well arranged format

inputNos.txt

70

95

62

88

90

85

75

79

50

80

82

88

81

93

75

78

62

55

89

94

73

82

___________________

StandardDev.java

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

public class StandardDev {

public static void main(String[] args) {

//Declaring variables

String filename;

int count = 0, i = 0;

Scanner sc1 = null;

int min, max;

double mean, stdDev;

int nos[] = null;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

//Getting the input entered by the user

System.out.print("Enter the name of the filename :");

filename = sc.next();

try {

//Opening the file

sc1 = new Scanner(new File(filename));

//counting no of numbers in the file

while (sc1.hasNext()) {

sc1.nextInt();

count++;

}

sc1.close();

sc1 = new Scanner(new File(filename));

//Creating an Integer based on the Count

nos = new int[count];

//Populating the values into an array

while (sc1.hasNext()) {

nos[i] = sc1.nextInt();

i++;

}

sc1.close();

//calling the methods

min = findMinimum(nos);

max = findMaximum(nos);

mean = calMean(nos);

stdDev = calStandardDev(nos, mean);

//Displaying the output

System.out.println("Read from file :" + count + " values");

System.out.println("The Minimum Number is :" + min);

System.out.println("The Maximum Number is :" + max);

System.out.printf("The Mean is :%.2f\n", mean);

System.out.printf("The Standard Deviation is :%.2f\n", stdDev);

} catch (FileNotFoundException e) {

e.printStackTrace();

}

}

//This method will calculate the standard deviation

private static double calStandardDev(int[] nos, double mean) {

//Declaring local variables

double standard_deviation = 0.0, variance = 0.0, sum_of_squares = 0.0;

/* This loop Calculating the sum of

* square of eeach element in the array

*/

for (int i = 0; i < nos.length; i++) {

/* Calculating the sum of square of

* each element in the array    

*/

sum_of_squares += Math.pow((nos[i] - mean), 2);

}

//calculating the variance of an array

variance = ((double) sum_of_squares / (nos.length - 1));

//calculating the standard deviation of an array

standard_deviation = Math.sqrt(variance);

return standard_deviation;

}

//This method will calculate the mean

private static double calMean(int[] nos) {

double mean = 0.0, tot = 0.0;

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Calculating the sum of all the elements in the array

tot += nos[i];

}

mean = tot / nos.length;

return mean;

}

//This method will find the Minimum element in the array

private static int findMinimum(int[] nos) {

int min = nos[0];

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Finding minimum element

if (nos[i] < min)

min = nos[i];

}

return min;

}

//This method will find the Maximum element in the array

private static int findMaximum(int[] nos) {

int max = nos[0];

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Finding minimum element

if (nos[i] > max)

max = nos[i];

}

return max;

}

}

_____________________

Output:

Enter the name of the filename :inputNos.txt

Read from file :22 values

The Minimum Number is :50

The Maximum Number is :95

The Mean is :78.45

The Standard Deviation is :12.45

cheers i hope this helped !!!

can a +2 management studnet from nepal study computer engineer in UK?​

Answers

Answer: The UK government offers a global scholarship programme called “Chevening”. It is open to all international students who meet the Chevening eligibility criteria, which states you must have applied for at least three degree courses in the UK, usually one-year Master's courses

Explanation: So yes that should be fine

Identify the flaws / limitations in the following ConvertToNumber method:


public static bool ConvertToNumber(string str)
{
bool canConvert = false;
try
{
int n = Int16.Parse(str);

if (n != 0)
{
canConvert = true;
}
}
catch (Exception ex)
{

}
bool retval = false;
if (canConvert == true)
{
retval = true;
}
return retval;
}

Answers

Answer:

Flaws and limitations identified in this program includes;

1.There was a not necessary usage of variable retrieval. Would have made use of canConvert.

2. Looking at the program, one will notice numerous typos. One of which is the fact that in JAVA we make use of Boolean instead of bool.

3.We rather use Integer.parseInt in JAVA and not Int16, cant make use of Int16.

4. The exception cant be printed

5. JAVA makes use of checkConversion instead of convertNumber as used in the program.

6. It cant work for decimal numbers, 0 and big integers.

Explanation:

See Answer for the detailed explaination of the flaws and limitations identified in the program.

Why is it important to use correct syntax?

ANSWER: D) to ensure the programs run properly and return expected results

Answers

Answer: True

Explanation:

Answer:

D

Explanation:

If your options are

a) to demonstrate a sophisticated programming style

b) to demonstrate a flexible programming style

c)to ensure that programs will work on any computer platform

d) to ensure that programs run properly and return expected results

Then yes this is very much correct!

Exact Target was acquired by Salesforce, which in turn was converted to __________.

Answers

Answer:

Salesforce Marketing Cloud.

Explanation:

Exact Target was founded by Peter McCormick, Chris Baggott and Scott Dorsey on the 15th of December, 2000 in Indianapolis, Indiana, United States of America and was later acquired by Salesforce in the year 2013 for $2.5 billion. Salesforce in turn converted Exact Target to Salesforce Marketing Cloud in the year 2014.

The Salesforce Marketing Cloud is a company that provide services such as digital marketing automation and analytics software. Salesforce Marketing Cloud softwares are sold primarily on a multi-year subscription basis and based on number of users, features enabled, and level of customer service. It is a hosted, online subscription model that provides users with services such as, consulting, mobile, implementation, email, social and digital marketing.

The style or appearance of text is called

Answers

font or typeface, defines the appearance and shape of the letters, numbers, and special characters. font size. specifies the size of the characters and is determined by a measurement system called points. format.

Answer: Font

Explanation:

You are building a predictive solution based on web server log data. The data is collected in a comma-separated values (CSV) format that always includes the following fields: date: string time: string client_ip: string server_ip: string url_stem: string url_query: string client_bytes: integer server_bytes: integer You want to load the data into a DataFrame for analysis. You must load the data in the correct format while minimizing the processing overhead on the Spark cluster. What should you do? Load the data as lines of text into an RDD, then split the text based on a comma-delimiter and load the RDD into a DataFrame. Define a schema for the data, then read the data from the CSV file into a DataFrame using the schema. Read the data from the CSV file into a DataFrame, infering the schema. Convert the data to tab-delimited format, then read the data from the text file into a DataFrame, infering the schema.

Answers

Answer:

see explaination

Explanation:

The data is collected in a comma-separated values (CSV) format that always includes the following fields:

? date: string

? time: string

? client_ip: string

? server_ip: string

? url_stem: string

? url_query: string

? client_bytes: integer

? server_bytes: integer

What should you do?

a. Load the data as lines of text into an RDD, then split the text based on a comma-delimiter and load the RDD into DataFrame.

# import the module csv

import csv

import pandas as pd

# open the csv file

with open(r"C:\Users\uname\Downloads\abc.csv") as csv_file:

# read the csv file

csv_reader = csv.reader(csv_file, delimiter=',')

# now we can use this csv files into the pandas

df = pd.DataFrame([csv_reader], index=None)

df.head()

b. Define a schema for the data, then read the data from the CSV file into a DataFrame using the schema.

from pyspark.sql.types import *

from pyspark.sql import SparkSession

newschema = StructType([

StructField("date", DateType(),true),

StructField("time", DateType(),true),

StructField("client_ip", StringType(),true),

StructField("server_ip", StringType(),true),

StructField("url_stem", StringType(),true),

StructField("url_query", StringType(),true),

StructField("client_bytes", IntegerType(),true),

StructField("server_bytes", IntegerType(),true])

c. Read the data from the CSV file into a DataFrame, infering the schema.

abc_DF = spark.read.load('C:\Users\uname\Downloads\new_abc.csv', format="csv", header="true", sep=' ', schema=newSchema)

d. Convert the data to tab-delimited format, then read the data from the text file into a DataFrame, infering the schema.

Import pandas as pd

Df2 = pd.read_csv(‘new_abc.csv’,delimiter="\t")

print('Contents of Dataframe : ')

print(Df2)

You have been allocated a class C network address of 211.1.1.0 and are using the default subnet mask of 255.255.255.0 how many hosts can you have?

Answers

Answer:thats is so easy obviously 69

Explanation:

Write a procedure named Str_find that searches for the first matching occurrence of a source string inside a target string and returns the matching position. The input parameters should be a pointer to the source string and a pointer to the target string. If a match is found, the procedure sets the Zero flag and EAX points to the matching position in the target string. Otherwise, the Zero flag is clear and EAX is undefined.

Answers

Answer: Provided in the explanation section

Explanation:

Str_find PROTO, pTarget:PTR BYTE, pSource:PTR BYTE

.data

target BYTE "01ABAAAAAABABCC45ABC9012",0

source BYTE "AAABA",0

str1 BYTE "Source string found at position ",0

str2 BYTE " in Target string (counting from zero).",0Ah,0Ah,0Dh,0

str3 BYTE "Unable to find Source string in Target string.",0Ah,0Ah,0Dh,0

stop DWORD ?

lenTarget DWORD ?

lenSource DWORD ?

position DWORD ?

.code

main PROC

  INVOKE Str_find,ADDR target, ADDR source

  mov position,eax

  jz wasfound           ; ZF=1 indicates string found

  mov edx,OFFSET str3   ; string not found

  call WriteString

  jmp   quit

wasfound:                   ; display message

  mov edx,OFFSET str1

  call WriteString

  mov eax,position       ; write position value

  call WriteDec

  mov edx,OFFSET str2

  call WriteString

quit:

  exit

main ENDP

;--------------------------------------------------------

Str_find PROC, pTarget:PTR BYTE, ;PTR to Target string

pSource:PTR BYTE ;PTR to Source string

;

; Searches for the first matching occurrence of a source

; string inside a target string.

; Receives: pointer to the source string and a pointer

;    to the target string.

; Returns: If a match is found, ZF=1 and EAX points to

; the offset of the match in the target string.

; IF ZF=0, no match was found.

;--------------------------------------------------------

  INVOKE Str_length,pTarget   ; get length of target

  mov lenTarget,eax

  INVOKE Str_length,pSource   ; get length of source

  mov lenSource,eax

  mov edi,OFFSET target       ; point to target

  mov esi,OFFSET source       ; point to source

; Compute place in target to stop search

  mov eax,edi    ; stop = (offset target)

  add eax,lenTarget    ; + (length of target)

  sub eax,lenSource    ; - (length of source)

  inc eax    ; + 1

  mov stop,eax           ; save the stopping position

; Compare source string to current target

  cld

  mov ecx,lenSource    ; length of source string

L1:

  pushad

  repe cmpsb           ; compare all bytes

  popad

  je found           ; if found, exit now

  inc edi               ; move to next target position

  cmp edi,stop           ; has EDI reached stop position?

  jae notfound           ; yes: exit

  jmp L1               ; not: continue loop

notfound:                   ; string not found

  or eax,1           ; ZF=0 indicates failure

  jmp done

found:                   ; string found

  mov eax,edi           ; compute position in target of find

  sub eax,pTarget

  cmp eax,eax    ; ZF=1 indicates success

done:

  ret

Str_find ENDP

END main

cheers i hoped this helped !!

Computer security experts devote their time and energy to the protection of sensitive data and the prevention of an outside attack on the internal network. They specialize in building secure firewalls as well as complex intrusion detection systems designed to keep intruders out. They watch and monitor the incoming message traffic very closely. But no matter how well they protect the private network from outside access without proper authority, they do not help prevent an attack by a malicious or disgruntled employee from the inside. And they cannot prevent breaches due to a simple lack of understanding of security policy by internal employees.When do YOU think an organization needs information systems security policies? Why?

Answers

Answer:

Information security policy are used for the prevention of intruders hacking a network when an organization start getting IT related attacks.

Explanation:

Information security policy are used for the prevention of intruders hacking a network when an organization start getting IT related attacks.

An information security policy are set of rules/policies designed to guide employees for the protection of the security of company information and IT systems. The reasons for these policies are:

It defines what is required from organization’s employees for the security of the IT systemsInformation security policies provide a means to secure the organization against external and internal threats Information security policies are a mechanism to for ensuring an organization’s legal and ethical responsibilities Information security policies are created to hold each employee responsible with regard to information security

Create a simple program that calls a function call gradeCalculated, in the main area the user is asked to enter their grade from 0-100. (Python)

Answers

Answer:

def gradeCalculated(score):

   if score < 60:

       letter = 'F'

   elif score < 70:

       letter = 'D'

   elif score < 80:

       letter = 'C'

   elif score < 90:

       letter = 'B'

   else:

       letter = 'A'

   return letter

def main():

   grade = int(input("enter your grade from 0-100: "))

   print("Letter grade for ",grade,"is:",gradeCalculated(grade))

   if(grade>80):

       print("You are doing good! keep it up!!")

   else:

       print("You have to get work hard")

main()

Explanation:

See attached image for output

1.Start vim to create a new file named pizza. vim pizza 2.Type i (lowercase i for input to put vim in Input mode and enter the following text, pressing RETURN at the end of each line. Ignore typing mistakes you make for now. Press ESCAPE when you are done typing to put vim back in Command mode. Pizza is an oven-baked, flat, round bread typically topped with a tomato sauce, cheese and various toppings. Pizza was originally invented in Naples, Italy, and the dish has since become popular in many parts of the world. (from Wikipedia) I

Answers

Answer:

vi [ -| -s ] [-l] [-L] [-R] [ -r [ filename ] ] [-S] [-t tag] [-v] [-V]

  [-x] [-w] [-n ] [-C] [+command | -c command ] filename

Explanation:

See attached image file

Consider the following relational schema, where the primary keys are Bold,
Students(sid, sname, address, dept_id)
Courses(cid, cname, dept_id)
Departments(dept_id, dname, college)
Grades(sid, cid, year, semester, grade)
Write the following queries in SQL. Only use the tables that are absolutely needed for the corresponding query.
1. Find the sids and snames of students who took "Database" course (i.e., cname = ‘Database’) in Fall 2019.
2. Find the average grade of all the students who took "CS327" (i.e., cid=‘CS327’) in Fall 2019. You can assume grade is a numerical attribute.
3. Find the number of distinct courses offered by each department in Fall 2019.
4. Find the sids of students who have taken at least 10 different courses offered by "Computer Science" department (i.e., dname = ‘Computer Science’).

Answers

Answer:

The queries for each question are explained.

1. Find the sids and snames of students who took "Database" course (i.e., cname = ‘Database’) in Fall 2019.

 The columns sid and sname are taken from students table.

The course name belong to the courses table.

The semester and year belong to the grades table.

To get the final query, all these tables need to be joined in the FROM clause using JOIN ON keywords.

select s.sid, sname

from students s join grades g on g.sid = s.sid

join courses c on g.cid = c.cid

where cname like 'database%'

and semester like 'Fall'

and year=2019

2. Find the average grade of all the students who took "CS327" (i.e., cid=‘CS327’) in Fall 2019. You can assume grade is a numerical attribute.

The grade column is taken from grades table.

The course id belongs to the grades table.

The semester and year also belong to the grades table.

The final query is formed using the grades table only.

 select avg(grade)

from grades

where cid like 'CS327'

and semester like 'Fall'

and year=2019

 3. Find the number of distinct courses offered by each department in Fall 2019.

 The department id belongs to the courses table.

The course id belongs to the grades table.

The semester and year also belong to the grades table.

To get the final query, the courses and the grades tables are joined in the FROM clause using JOIN ON keywords.

select dept_id, count(distinct g.cid)

from courses c join grades g on c.cid = g.cid

where semester like 'Fall'

and year=2019

group by dept_id

Answer each of the following with a TRUE (T) or FALSE (F).
(1) Pipelining allows instructions to execute sequentially.
(2) If you can find the value x in the cache, you can also find it in the main memory too.
(3) Only the lw instruction can access the Data Memory component.
(4) The bias in single precision is 127, while in double precision it is 1024.
(5) In a cache mapping architecture, the valid bit is always on until data is found in that specific block.
(6) Memory speed generally gets faster the farther you move from the processor.
(7) A cache is a small high speed memory that stores a subset of the information that is in RAM.
(8) The hit rate of a cache mapping architecture is calculated by doing 1 - hit penalty.
(9) Cache is the fastest type of memory.
(10) Single-cycle and multi-cycle machines differ in CPI but all the other values are the same.

Answers

Answer:

t

Explanation:

____ is scientifically seeking and discovering facts.

Answers

Answer:

I believe it is science, but before you do anything with this answer, research more on it, just in case I'm wrong! :)

Explanation:

Double any element's value that is less than controlValue. Ex: If controlValue = 10, then dataPoints = {2, 12, 9, 20} becomes {4, 12, 18, 20}.

import java.util.Scanner; public class StudentScores { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int NUM_POINTS = 4; int[] dataPoints = new int[NUM_POINTS]; int controlValue; int i; controlValue = scnr.nextInt(); for (i = 0; i < dataPoints.length; ++i) { dataPoints[i] = scnr.nextInt(); } for (i = 0; i < dataPoints.length; ++i) { System.out.print(dataPoints[i] + " "); } System.out.println(); } }

Answers

Answer:

import java.util.Scanner;

public class StudentScores

{

public static void main(String[] args) {

 Scanner scnr = new Scanner(System.in);

 final int NUM_POINTS = 4;

 int[] dataPoints = new int[NUM_POINTS];

 int controlValue;

 int i;

 controlValue = scnr.nextInt();

 for (i = 0; i < dataPoints.length; ++i) {

     dataPoints[i] = scnr.nextInt();

 }

 for (i = 0; i < dataPoints.length; ++i) {

     System.out.print(dataPoints[i] + " ");

 }

 System.out.println();

 for (i = 0; i < dataPoints.length; ++i) {

     if(dataPoints[i] < controlValue){

         dataPoints[i] = dataPoints[i] * 2;          

     }

     System.out.print(dataPoints[i] + " ");

 }

}

}

Explanation:

*Added parts highligted.

After getting the control value and values for the array, you printed them.

Create a for loop that iterates through the dataPoints. Inside the loop, check if a value in dataPoints is smaller than the contorolValue. If it is, multiply that value with 2 and assign it to the dataPoints array. Print the elements of the dataPoints

Answer:

import java.util.Scanner;

public class numm3 {

   public static void main (String [] args) {

       Scanner scnr = new Scanner(System.in);

       final int NUM_POINTS = 4;

       int[] dataPoints = new int[NUM_POINTS];

       int controlValue;

       int i;

       System.out.println("Enter the control Variable");

       controlValue = scnr.nextInt();

       System.out.println("enter elements for the array");

       for (i = 0; i < dataPoints.length; ++i) {

           dataPoints[i] = scnr.nextInt();

       }

       for (i = 0; i < dataPoints.length; ++i) {

           System.out.print(dataPoints[i] + " ");

       }

       System.out.println();

       //Doubling elements Less than Control Variable

       for (i = 0; i < dataPoints.length; ++i) {

           if (dataPoints[i]<controlValue){

               dataPoints[i] = dataPoints[i]*2;

           }

           System.out.print(dataPoints[i] + " ");

       }

       System.out.println(); } }

Explanation:

See the additional code to accomplish the task in bold

The trick is using an if statement inside of a for loop that checks the condition (dataPoints[i]<controlValue) If true, it multiplies the element by 2


A customer seeks to buy a new computer for private use at home. The customer primarily needs the computer to use the Microsoft PowerPoint application for the purpose of practicing presentation skills. As a salesperson what size hard disc would you recommend and why?

Answers

Answer:

at this day and age, any. My questions would focus around other applications at this point.  250 gb or larger.

Explanation:

Office 365 only uses 4 GB "Microsoft's store page", the smallest hard drives commonly available are 250 GB and larger.  

It is only likely for a guest to receive outstanding service at luxury brands. That's why Ritz-Carlton, Mandarin Oriental, Four Seasons, and others are the best at what they do.

Answers

Answer:

FALSE

Explanation:

"Dean wants a quick way to look up staff members by their Staff ID. In cell Q3, nest the existing VLOOKUP function in an IFERROR function. If the VLOOKUP function returns an error result, the text ""Invalid Staff ID"" should be displayed by the formula. (Hint: You can test that this formula is working by changing the value in cell Q2 to 0, but remember to set the value of cell Q2 back to 1036 when the testing is complete.)"

Answers

Answer:

ierror(VLOOKUP(Q2,CBFStaff[[Staff ID]:[Name]],2,FALSE), "Invalid Staff ID")

Explanation:

Let me try as much as I can to explain the concept or idea of iferror in vlookup.

iferror have a typically function and result like an if else statement, its syntax is IFERROR(value,value _ if _ error), this simply means that if the the error is equal to value, value is returned if not, the next argument is returned.

Having said that, feom the question we are given,

let's substitute the value with vlookup function and add an else argument, it will look exactly this way;

IFERROR(VLOOKUP(),"Invalid Staff ID")// now this will set the message if vlookup cannot find the.

On the other hand using the values given, we will have;

ierror(VLOOKUP(Q2,CBFStaff[[Staff ID]:[Name]],2,FALSE), "Invalid Staff ID")

This assignment deals with Logical Equivalences. Review section 1.7 of the text before completing the assignment. The assignment may be handed in twice before it is graded. Consider the statements in the left column of the tables below. Translate each into a propositional statement. In the box below, indicate which two statements are logically equivalent. The gray shaded box is the Equation editor that should be used to enter the propositional expression.
Question 1
Statement Reason
Whenever there is a puppy in the house, I feel happy
If I am happy, then there is a puppy in the house
If there is not a puppy in the house, then I am not happy.
If I am not happy, then there is no puppy in the house
Question 2
Statement Reason
If I am in school today, then I am in CSC231 class
If I am not in school today, then I am not civics class
If I am not in CSC231 class, then I am not in school today
If I am in CSC231 class, then I am in school today

Answers

Answer:

Question (1) the statements (i) and( iv) are logically equivalent and statements (ii) and (iii) are logically equivalent. Question (2) the statements (i) and (iii) are logically equivalent.

Explanation:

Solution

Question (1)

Now,

Lets us p as puppy in the house, and q as i am happy

So,

p : puppy in the house,  and q : i am happy

Thus,

The Statements

(i) so if there is a puppy in the house, I feel happy :  p -> q

(ii) If I am happy, then there is a puppy in the house : q -> p

(iii) If there is no puppy in the house, then I am not happy.   : ~ p -> ~q

(iv) If I am not happy, then there is no puppy in the house : ~q -> ~p

Hence, the statements (i) and( iv) are logically equivalent and statements (ii) and (iii) are logically equivalent.

Question (2)

Let us denote p as i am in school today, and q as i am in CSC231 class, and r as i am in civics class,

So,

p: i am in school today, q: i am in CSC231 class, r: i am in civics class,

Now,

(i) if I am in school today, then I am in CSC231 class  :p -> q

(ii) If I am not in school today, then I am not civics class  :~p -> ~r

(iii) If I am not in CSC231 class, then I am not in school today  :~q -> ~p

(iv) If I am in CSC231 class, then I am in school today  : q -> p

Therefore, the statements i) and iii) are logically equivalent.

Chemical equations of Carbon + water​

Answers

Answer:

Aqueous carbon dioxide, CO2 (aq), reacts with water forming carbonic acid, H2CO3 (aq). Carbonic acid may loose protons to form bicarbonate, HCO3- , and carbonate, CO32-. In this case the proton is liberated to the water, decreasing pH. The complex chemical equilibria are described using two acid equilibrium equations.

PLS MARK AS BRAINLIEST

Assume variables SimpleWriter out and int n are already declared in each case. Write a while loop that printsA. All squares less than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81.B. All positive numbers that are divisible by 10 and less than n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90C. All powers of two less than n. For example, if n is 100, print 1 2 4 8 16 32 64.

Answers

Answer:

This program has been written using JAVA. The code is written beloe:

// import library

import java.util.Scanner;

public category Main operate

public static void main(String[] args)

{

// scanner category

Scanner scan=new Scanner(System.in);

System.out.println("Enter Number:");

int n=scan.nextInt();

//All squares but n

System.out.println("All squares but n are: ");

int temp=0,square=0,i=0;

while(square

range

square=i*i;

if(square>=n)break;

System.out.print(square+" ");

i++;

}

//All positive numbers that are divisible by 10 but less than n

System.out.println(" ");

System.out.println(" ");

System.out.println("All positive numbers are divisible by 10 and less than n are: ");

i=1;

while(i

{

if(i%10==0)

System.out.print(i+" ");

if(i>=n)break;

i++;

}

System.out.println(" ");

System.out.println(" ");

System.out.println("All powers of 2 that are less than n are: ");

//All powers of 2 less than n

i=0;

while(i

mathematics.pow(2, i);

if(num_power

System.out.print(num_power+" ");

i++;

}

}

}

Explanation:

With SimpleWriter out and int n already declared in each case this program makes use of a while loop condition to satisfy the following;

1. All squares less than n

2. positive numbers that are divisible by 10 and less than n.

3. All powers of two less than n.

Suppose the daytime processing load consists of 65% CPU activity and 35% disk activity. Your customers are complaining that the system is slow. After doing some research, you learn that you can upgrade your disks for $8,000 to make them 3 times as fast as they are currently. You have also learned that you can upgrade your CPU to make it 1.5 times faster for $6,000. a) Which would you choose to yield the best performance improvement for the least
amount of money?
b) Which option would you choose if you don’t care about the money, but want a
faster system?
c) What is the break-even point for the upgrades? That is, what price would be
charged for the CPU(or the disk--change only one) so the results was the same cost per 1% increase in both.

Answers

Answer:

The answer to this question can be described as follows:

Explanation:

Given data:

Performance of the CPU:  

The Fastest Factor Fraction of Work:

[tex]f_1=65 \% \\\\=\frac{65}{100} \\\\ =0.65[/tex]

Current Feature Speedup:

[tex]K_1=[/tex] 1.5

CPU upgrade=6000

Disk activity:

The quickest part is the proportion of the work performed:

Current Feature Speedup:

[tex]k_2=3[/tex]

Disk upgrade=8000

System speedup formula:

[tex]s=\frac{1}{(1-f)+(\frac{f}{k})}[/tex]

Finding the CPU activity and disk activity by above formula:

CPU activity:

[tex]S_{CPU}=\frac{1}{(1-f_1)+(\frac{f_1}{k_1})} \\\\=\frac{1}{(1-0.65)+(\frac{0.65}{1.5})} \\\\=1.276 \% ...\rightarrow (1) \\[/tex]

Disk activity:

[tex]S_{DISK} = (\frac{1}{(1-f_2)+\frac{f_2}{k_2}}) \\\\ S_{DISK} = (\frac{1}{(1-0.35)+\frac{0.35}{3}}) \\\\ = -0.5\% .... \rightarrow (2)[/tex]

CPU:

Formula for CPU upgrade:

[tex]= \frac{CPU \ upgrade}{S_{CPU}}\\\\= \frac{\$ 6,000}{1.276}\\\\= 4702.19....(3)[/tex]

DISK:

Formula for DISK upgrade:

[tex]=\frac{Disk upgrade} {S_{DISK}}\\\\= \frac{\$ 8000}{-0.5 \% }\\\\= - 16000....(4)[/tex]

equation (3) and (4),

Thus, for the least money the CPU alternative is the best performance upgrade.

b)

From (3) and (4) result,

The disc choice is therefore the best choice for a quicker system if you ever don't care about the cost.

c)

The break-event point for the upgrades:

=4702.19 x-0.5

= -2351.095

From (2) and (3))

Therefore, when you pay the sum for disc upgrades, all is equal $ -2351.095

Ronaldo wants to determine if employees would prefer having bagels or
donuts at morning meetings. Which method would be best to collect this
information?

Answers

Answer:

surveys and questionnaires

Answer:

Survey

Explanation:

Given the following Java code:
public static boolean f(int [] arr) {
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i + 1; j < arr.length; j++) {
if (arr[i] < arr[j]) // *HERE*
return false;}
return true;}
(i) Find the number of times the comparison marked by *HERE* will be evaluated for each input:
{1, 2}
{10, 20, 30}
{30, 20, 10}
{-4, 7, 1}
(ii) For an array of size ????, what is the big-oh runtime of this code in the worst case?

Answers

Answer:

See explaination

Explanation:

{1, 2}

Runs only once for 1 < 2

{10, 20, 30}

Runs 1 for 10 < 20

Runs 1 for 10 < 30

Runs 1 for 20 < 30

Total 3 times

{30, 20, 10}

Runs 1 for 30 < 20

Runs 1 for 30 < 10

Runs 1 for 20 < 10

Total 3 times

{-4, 7, 1}

Runs 1 for -4 < 7

Runs 1 for -4 < 1

Runs 1 for -7 < 1

​​​​​​​Total 3 times

Generalizing it will run for n*(n-1)/2 so for 2 element it will run for 2*1/2 = 1

For 3 element it will run for 3*2/2 = 3 times

(ii) (3 points) For an array of size , what is the big-oh runtime of this code in the worst case?

Time complexity in Worst case is O(n^2). Reason being it uses two for loop where first loop runs for n time and the second loop runs for n*n time in worst case hence its O(n^2)

Which three statements about RSTP edge ports are true? (Choose three.) Group of answer choices If an edge port receives a BPDU, it becomes a normal spanning-tree port. Edge ports never generate topology change notifications (TCNs) when the port transitions to a disabled or enabled status. Edge ports can have another switch connected to them as long as the link is operating in full duplex. Edge ports immediately transition to learning mode and then forwarding mode when enabled. Edge ports function similarly to UplinkFast ports. Edge ports should never connect to another switch.

Answers

Answer:

Edge ports should never connect to another switch. If an edge port receives a BPDU, it becomes a normal spanning-tree port. Edge ports never generate topology change notifications (TCNs) when the port transitions to a disabled or enabled status.

in most operating systems what is running application called?

Answers

Answer:

I believe it is just a task. Since there exists(on windows) the Task Manager application, where you can stop any running task, I think that they are called tasks

Explanation:

In most operating systems, a running application is typically referred to as a process. A process is an instance of a program that is being executed by the operating system. It represents the execution of a set of instructions and includes the program code, data, and resources required for its execution.

Each process has its own virtual address space, which contains the program's code, variables, and dynamically allocated memory. The operating system manages and schedules these processes, allocating system resources such as CPU time, memory, and input/output devices to ensure their proper execution.

The operating system provides various mechanisms to manage processes, such as process creation, termination, scheduling, and inter-process communication.

Learn more about operating systems here:

brainly.com/question/33924668

#SPJ6

For this problem, use a formula from this chapter, but first state the formula. Frames arrive randomly at a 100-Mbps channel for transmission. If the channel is busy when a frame arrives, it waits its turn in a queue. Frame length is exponentially distributed with a mean of 10,000 bits/frame. For each of the following frame arrival rates, give the delay experienced by the average frame, including both queueing time and transmission time.
a. 90 frames/ sec.
b. 900 frames/ sec.
c. 9000 frames/ sec

Answers

Answer:

(a). 0.1 × 10^-3 = 0.1 msec.

(b). 0.11 × 10^-3 = 0.11 msec.

(c). 1 × 10^-3. = 1 msec.

Explanation:

So, in order to solve this problem or question there is the need to use the Markov queuing formula which is represented mathematically as below;

Mean time delay, t = /(mean frame length,L) × channel capacity, C - frame arrival rate, F. ---------------------------------(1).

(a). Using equation (1) above, the delay experience by 90 frames/sec.

=> 1/(10^-4× 10^8 - 90). = 0.1 × 10^-3= 0.1 msec.

(b). Using equation (1) above, the delay experience by 900 frames/sec.

=> 1/(10^-4× 10^8 - 900). = 0.11 × 10^-3= 0.11 msec.

(c). Using equation (1) above, the delay experience by 90 frames/sec.

=> 1/(10^-4× 10^8 - 9000). = 1 × 10^-3= 1 msec.

Hence, the operating queuing system is; 900/10^-4 × 10^8 = 0.9.

What happens in the process represented by the flowchart ?

A) The person drinks water if the answer to “Thirsty?” is no.
B) The person always drinks water.
C) The person drinks water if the answer to “Thirsty?” is yes.
D) The person never drinks water.

CORRECT ANSWER: C!!!

Answers

Answer:

the person drinks water if the answer to “thirsty?” is yes

Answer:

C

Explanation:

Write a loop that continually asks the user what pets the user has, until the user enters "rock", in which case the loop ends. It should acknowledge the user in the following format. For the first pet, it should say "You have a dog with a total of 1 pet(s)" if they enter dog, and so on.
Sample Run:
User enters:
lemur parrot cat rock
Outputs:
You have a lemur with a total of 1 pet(s)
You have a parrot with a total of 2 pet(s)
You have a cat with a total of 3 pet(s)

Answers

Answer:

Check the explanation

Explanation:

The Python program that frequently asks the user what pets the user has,

until the user enters "rock", in which case the loop ends can be analysed in the written codes below.

'''

# count of pets

count = 0

# read the user input

pet = input()

# loop that continues till the user enters rock

# strip is used to remove the whitespace

while pet.strip() != 'rock':

  # increment the count of pets

  count += 1

  # output the pet name and number of pets read till now

  print('You have a %s with a total of %d pet(s)' %(pet.strip(),count))

  pet = input() # input the next pet

#end of program

Following are the python program to use the loop to count the number of pets until the user enters the "rock":

Program:

c = 0#defining a variable c that initilzes with 0

p = input()#defining a variable p that input value

while p != 'rock':#defining a loop that check p value not equal to rock

  c += 1#using c variable for counts total number of pets

  print('You have a %s with a total of %d pet(s)' %(p,c))#print total number of pet

  p = input() #input value

Output:

Please find the attached file.

Program Explanation:

Defining a variable "c" that is initialized with 0, which is used to count input values.In the next line, a "p" variable is declared as the input value from the user end.A while loop is declared to check that the p-value is not equal to 'rock'.Inside this loop, the "c" variable is used for counting the total number of pets, and a print method is used to print the total number of pets.Another input method is used that works until the user inputs the value that is "rock".

Find out more about the loop here:

brainly.com/question/17067964

Other Questions
Write a code for the following requirement.The program must prompt for a name, and then tell the user how many letters are in the name, what the first letter of the name is, and what the last letter of the name is. It should then end with a goodbye message. A sample transcript of what your program should do is below - user input is in bold: Enter your name: JeremyHello Jeremy! Your name is 6 letters long. Your name starts with a J. Your name ends with a y. Goodbye! In quadrilateral BCED, we have BD = 11, BC = 9, and CE=2. Sides BD and CE are extended past B and C, respectively, to meet at point A. If AC = 28 and AB = 24, then what is DE? Solving for x and y When checking for breathing, if you hear gasps Someone please help me 3) Impressed by your mathematical vocabulary and ability to find the meaning of his favoritesesquipedalianism, Viking would like to award Norman 8 Swedish Fish for every letter in the LASTword of its meaning. How many Swedish Fish is Viking giving Norman? What amount of time does each black line on thetimeline represent?Why is there a space between 1600 and 1989?_What does the timeline say about the discovery of theasteroid moon?_What would be the best title for this timeline?_ what is the y-intercept of the quadratic function f(x) = (x-6)(x-2) 19. The volcanic peak of this mountain is the highest point in Africa. A. Mount Everest B. Mount Kilimanjaro C. Mount Rainier D. Mount Rushmore Which are correct representations of the inequality 6x2 3 + 4(2x - 1)? Select three options. i need a answer FAST . HELP!!! THIS IS URGENT!!!Explain how you could use less than or equal to and greater than or equal to in a real life scenario.Please come up with an original scenario! I really need help! Giving 35 points! New evidence can lead to a change in scientific knowledge. Group of answer choices True False First CORRECT answer WILL get Brainliest. Im on a limited time so if you dont know, dont answer. No guesses, not what you think, accurate and correct answers. I apologize if I am coming off as rude, but I honestly dont have the time to delete questions. Thank you in advance! How well do you think president Kennedy handled the Cuban missile crisis? I need the answer to number 9. Please! And if you have answers to the other questions;sharing them would be greatly appreciated. :D Could two parents with cleft-chin have a child without cleft-chin? Derive the expression of the mechanical energy for under damped system. Giving 15 points need answer ASAP Energy producing technologies can positively impact soil fertility.Please select the best answer from the choices providedTFMark this and returnSave and yit