Answer:
I hope this helps
Explanation:
The answer is new features
Answer:
New features (B)
Explanation:
Write some code that assigns True to the variable is_a_member if the value assigned to member_id can be found in the current_members list. Otherwise, assign False to is_a_member. In your code, use only the variables current_members, member_id, and is_a_member.
Answer:
current_members = [28, 0, 7, 100]
member_id = 7
if member_id in current_members:
is_a_member = True
else:
is_a_member = False
print(is_a_member)
Explanation:
Although it is not required I initialized the current_members list and member_id so that you may check your code.
After initializing those, check if member_id is in the current_members or not using "if else" structure and "in" ("in" allows us to check if a variable is in a list or not). If member_id is in current_members, set the is_a_member as True. Otherwise, set the is_a_member as False.
Print the is_a_member to see the result
In the example above, since 7 is in the list, the is_a_member will be True
Write a program that will print out statistics for eight coin tosses. The user will input either an "h" for heads or a "t" for tails for the eight tosses. The program will then print out the total number and percentages of heads and tails. Use the increment operator to increment the number of tosses as each toss is input. For example, a possible sample dialog might be: For each coin toss enter either ‘h’ for heads or ‘t’ for tails. First toss: h Second toss: t Third toss: t Fourth toss: h Fifth toss: t Sixth toss: h Seventh toss: t Eighth toss: t Number of heads: 3 Number of tails: 5 Percent heads: 37.5 Percent tails: 62.5
Answer:
Written in Python
head = 0
tail = 0
for i in range(1,9):
print("Toss "+str(i)+": ")
toss = input()
if(toss == 'h'):
head = head + 1
else:
tail = tail + 1
print("Number of head: "+str(head))
print("Number of tail: "+str(tail))
print("Percent head: "+str(head * 100/8))
print("Percent tail: "+str(tail * 100/8))
Explanation:
The next two lines initialize head and tail to 0, respectively
head = 0
tail = 0
The following is an iteration for 1 to 8
for i in range(1,9):
print("Toss "+str(i)+": ")
toss = input() This line gets user input
if(toss == 'h'): This line checks if input is h
head = head + 1
else: This line checks otherwise
tail = tail + 1
The next two lines print the number of heads and tails respectively
print("Number of head: "+str(head))
print("Number of tail: "+str(tail))
The next two lines print the percentage of heads and tails respectively
print("Percent head: "+str(head * 100/8))
print("Percent tail: "+str(tail * 100/8))
Implement a class Balloon that models a spherical balloon that is being filled with air. The constructor constructs an empty balloon. Supply these methods:
void addAir(double amount) adds the given amount of air.
double getVolume() gets the current volume.
double getSurfaceArea() gets the current surface area.
double getRadius() gets the current radius.
Supply a BalloonTester class that constructs a balloon, adds 100cm^3 of air, tests the three accessor methods, adds another 100cm3 of air, and tests the accessor methods again.
Answer:
Here is the Balloon class:
public class Balloon { //class name
private double volume; //private member variable of type double of class Balloon to store the volume
public Balloon() { //constructor of Balloon
volume = 0; } //constructs an empty balloon by setting value of volume to 0 initially
void addAir(double amount) { //method addAir that takes double type variable amount as parameter and adds given amount of air
volume = volume + amount; } //adds amount to volume
double getVolume() { //accessor method to get volume
return volume; } //returns the current volume
double getSurfaceArea() { //accessor method to get current surface area
return volume * 3 / this.getRadius(); } //computes and returns the surface area
double getRadius() { //accessor method to get the current radius
return Math.pow(volume / ((4 * Math.PI) / 3), 1.0/3); } } //formula to compute the radius
Explanation:
Here is the BalloonTester class
public class BalloonTester { //class name
public static void main(String[] args) { //start of main method
Balloon balloon = new Balloon(); //creates an object of Balloon class
balloon.addAir(100); //calls addAir method using object balloon and passes value of 100 to it
System.out.println("Volume "+balloon.getVolume()); //displays the value of volume by getting value of volume by calling getVolume method using the balloon object
System.out.println("Surface area "+balloon.getSurfaceArea()); //displays the surface area by calling getSurfaceArea method using the balloon object
System.out.println("Radius "+balloon.getRadius()); //displays the value of radius by calling getRadius method using the balloon object
balloon.addAir(100); //adds another 100 cm3 of air using addAir method
System.out.println("Volume "+balloon.getVolume()); //displays the value of volume by getting value of volume by calling getVolume method using the balloon object
System.out.println("Surface area "+balloon.getSurfaceArea()); //displays the surface area by calling getSurfaceArea method using the balloon object
System.out.println("Radius "+balloon.getRadius()); } } //displays the value of radius by calling getRadius method using the balloon object
//The screenshot of the output is attached.
Which describes the outlining method of taking notes?
It is easy to use in fast-paced lectures to record information.
It is the least common note-taking method.
It includes levels and sublevels of information.
It uses columns and rows to organize information.
Answer:
It includes levels and sublevels of information
Explanation:
The Outlining method of taking notes helps the writer to organize his ideas into levels and sublevels of information which gives the piece of writing an added structure.
This can be achieved by the use of the Arabic numbering system, Roman numerals or use of bullets.
Answer:
C : It includes levels and sublevels of information
Explanation:
can a computer Act on its own?
Answer:
hope this helps...
Explanation:
A computer can only make a decision if it has been instructed to do so. In some advanced computer systems, there are computers that have written the instructions themselves, based on other instructions, but unless there is a “decision point”, the computer will not act on its own volition.
PLEASE THANK MY ANSWER
Nowadays computer games are mostly available on external
hard disk.
Is it true or false?
Answer:
false
Explanation:
because a lot of times they are downloads without the disk
It is false that nowadays computer games are mostly available on external hard disk.
What is hard disk?A hard disk drive (HDD) is a type of computer storage device that uses magnetic storage to store and retrieve digital information.
Hard disks are usually located inside the computer and are used to store the operating system, applications, and user data such as documents, pictures, and videos.
Computer games can be stored on a variety of devices, including internal hard drives, external hard drives, solid state drives, and even cloud storage.
While external hard drives may be a popular option for some users, computer games can be installed and played from a variety of storage devices depending on user preferences and hardware capabilities.
Thus, the given statement is false.
For more details regarding hard disk, visit:
https://brainly.com/question/9480984
#SPJ2
An example of an access control is a: Multiple Choice Check digit. Password. Test facility. Read only memory.
Answer:
B. Password
Explanation:
An access control can be defined as a security technique use for determining whether an individual has the minimum requirements or credentials to access or view resources on a computer by ensuring that they are who they claim to be.
Simply stated, access control is the process of verifying the identity of an individual or electronic device. Authentication work based on the principle (framework) of matching an incoming request from a user or electronic device to a set of uniquely defined credentials.
Basically, authentication is like an access control, ensures a user is truly who he or she claims to be, as well as confirm that an electronic device is valid through the process of verification
An example of an access control is a password because it is typically a basic and fundamental front-line defense mechanism against an unauthorized use of data or cyber attacks from hackers.
Create a function min_mid_max which takes a list as its formal parameter and returns a new list with the following characteristics: element 0 contains the minimum value • element 1 contains the middle value (not the median -- which would require an average if the list had an even number of elements). If the list is even (e.g. [1,2,3,4]) the 'middle' value will be the right value of the two possible choices (e.g. 3 rather than 2). • element 2 contains the maximum value Notes: • You can only use Python syntax shown so far (even if you know more) • You cannot use any math library (we have yet to see this) • You should use the function sorted. Remember the function sorted does not change its input, it returns a new list. • You should only need to call sorted one time. print(sorted(3,2,1])) • You can use the function int (another built in function) to help determine the index of the middle value. This function takes a floating point (or any kind of number) and converts it into an integer (e.g.print(int(4.32)). This will allow you to treat lists with an even number of elements the same as a list with a odd number of elements. • If min_mid_max is called with an empty list, return an empty list. • If min_mid_max is called with 1 item that item is the min, mid, and the max • If min_mid_max is called with 2 items, the mid and the max should be the same • No need to worry about the incoming list being the value None
Answer:
Follows are the code to this question:
def min_mid_max(myList):#defining a method min_mid_max that accept a list in parameter
if len(myList)==0:#defining if block that check list length equal to 0
return []#return empty list
s = sorted(myList)#defining variable s that uses the sorted method to sort the list
m = int(len(myList)/2)#defining mid variable that hold list mid value
return [s[0], s[m], s[-1]]#return list values
print(min_mid_max([1,2,3,4]))#use print function to call method
print(min_mid_max([]))#use print function to call method
print(min_mid_max([1, 2]))#use print function to call method
print(min_mid_max([1]))#use print function to call method
Output:
Please find the attached file.
Explanation:
In the given code, a method "min_mid_max" is defined, which accepts a list "myList" in parameter, inside the method if block is used, that check length of the list.
If it is equal to 0, it will return an empty list, otherwise, a variable "s" is declared, that use the sorted method to sort the list, and in the "m" variable, it holds the mid number of list and returns its value.
In the print method, we call the above method by passing a list in its parameter.
what are the steps to troubleshoot a frozen computer
How do the different layers of e protocol hierarchy interact with each other? Why do we need to have two different layers that work on error detection and correction?
What is the difference in between data science and data analytics?
Answer:
Data analytics focuses more on viewing the historical data in context while data sciene focuses more on machine.
Explanation:
Data analytics is more specific and concentrated than data science.
What is the force produced by a 100 kg object that accelerates at 5 m/s2?
Answer:
500N
Explanation:
force=mass*acceleration
f=m*a
f=100kg*5m/s^2
f=500kgm/s^2 or 500N
hope helps you
#include
using namespace std;
const int SIZE = 4;
bool isSorted(const int arr[], int size);
bool isNonDecreasing(const int arr[], int size);
bool isNonIncreasing(const int arr[], int size);
void printArr(const int arr[], int size);
int main()
{
int test1[] = { 4, 7, 10, 69 };
int test2[] = { 10, 9, 7, 3 };
int test3[] = { 19, 12, 23, 7 };
int test4[] = { 5, 5, 5, 5 };
if (!isSorted(test1, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test1, SIZE);
if (!isSorted(test2, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test2, SIZE);
if (!isSorted(test3, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test3, SIZE);
if (!isSorted(test4, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test4, SIZE);
return 0;
}
bool isSorted(const int arr[], int size)
{
// TODO: This function returns true if the array is sorted. It could be
// sorted in either non-increasing (descending) or non-decreasing (ascending)
// order. If the array is not sorted, this function returns false.
// HINT: Notice that the functions isNonDecreasing and isNonIncreasing are not
// called from main. Call the isNonDecreasing and isNonIncreasing functions here.
}
bool isNonDecreasing(const int arr[], int size)
{
// TODO: Loop through the array to check whether it is sorted in
// non-decreasing (in other words, ascending) order. If the array
// is non-decreasing, return true. Otherwise, return false.
}
bool isNonIncreasing(const int arr[], int size)
{
// TODO: Loop through the array to check whether it is sorted in
// non-increasing (in other words, descending) order. If the array
// is non-increasing, return true. Otherwise, return false.
}
void printArr(const int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl << endl;
}
Output
SORTED
4 7 10 69
SORTED
10 9 7 3
NOT SORTED
19 12 23 7
SORTED
5 5 5 5
Code
//The added part is in the bottom
#include <iostream>
using namespace std;
const int SIZE = 4;
bool isSorted (const int arr[], int size);
bool isNonDecreasing (const int arr[], int size);
bool isNonIncreasing (const int arr[], int size);
void printArr (const int arr[], int size);
int
main ()
{
int test1[] = { 4, 7, 10, 69 };
int test2[] = { 10, 9, 7, 3 };
int test3[] = { 19, 12, 23, 7 };
int test4[] = { 5, 5, 5, 5 };
if (!isSorted (test1, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test1, SIZE);
if (!isSorted (test2, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test2, SIZE);
if (!isSorted (test3, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test3, SIZE);
if (!isSorted (test4, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test4, SIZE);
return 0;
}
bool
isSorted (const int arr[], int size)
{
//Added part
if (isNonDecreasing (arr, size) || isNonIncreasing (arr, size))
{
return true;
}
else
{
return false;
}
}
bool
isNonDecreasing (const int arr[], int size)
{
for (int i = 0; i < (size - 1); i++)
{
if (arr[i] > arr[i + 1]) //It compares the n value with the n-1 value and output
{
return false;
break;
}
}
return true;
}
bool
isNonIncreasing (const int arr[], int size)
{
for (int i = 0; i < (size - 1); i++)
{
if (arr[i] < arr[i + 1]) //It compares the n value with the n-1 value and output reautilization of previous function by replacing only “<”
{
return false;
break;
}
}
return true;
}
void
printArr (const int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl << endl;
}
As a twist on the Hello World exercise, you are going to be the end user of the Hello class. This class is designed to greet the user in a variety of world languages. For this task, complete the following:
Use the Scanner class to ask the user for their name.
Create a Hello object by passing the name to the constructor.
Call at least 3 methods from the Hello class to print the greeting in 3 different languages.
Remember to write your code in the HelloTester class, but make sure you take a look at the Hello class so that you know the names of the methods you need to use.
Answer:
Here is the Hello class:
public class Hello { //class name
private String name; //to store the name
public Hello (String names) //parameterized constructor
{ name = names; }
public void English() { //method to greet user in english
System.out.print("Hello "); //displays Hello on output screen
System.out.print(name); //displays user name
System.out.println("!"); } //displays exclamation mark symbol
public void Spanish(){ //method to greet user in spanish
System.out.print("Hola "); //displays Hello on output screen
System.out.print(name); //displays user name
System.out.println("!"); } //displays exclamation mark symbol
public void French() { //method to greet user in french
System.out.print("Bonjour "); //displays Hello on output screen
System.out.print(name); //displays user name
System.out.println("!"); } } //displays exclamation mark symbol
Explanation:
Here is the HelloTester class:
import java.util.Scanner; //to accept input from user
public class HelloTester { //class name
public static void main (String[]args) { //start of main method
String name; //to store the name of user
Scanner input = new Scanner(System.in); //creates Scanner class object
System.out.println("Enter name?" ); //prompts user to enter name
name = input.nextLine(); //scans and reads the name from user
Hello hello = new Hello(name); //creates Hello class object and calls constructor by passing name
hello.English(); //calls English method using object hello to greet in english
hello.Spanish(); //calls Spanish method using object hello to greet in spanish
hello.French(); } } //calls French method using object hello to greet in french
The output of the program is:
Enter name? user Hello user! Hola user! Bonjour user!
The screenshot of the program along with its output is attached.
Java is one of the most popular programming languages that is being widely used in the IT industry. It is simple, robust, and helps us to reuse the code.
The required program is,
\\import java.util.Scanner;
class Hello
{
private String name;
public Hello(String yourName)
{
name=yourName;
}
public void english()
{
System.out.print("Hello ");
System.out.print(name);
System.out.println("!");
}
public void spanish()
{
System.out.print("Holla ");
System.out.print(name);
System.out.println("!");
}
public void french()
{
System.out.print("Bonjour ");
System.out.print(name);
System.out.println("!");
}
public void german()
{
System.out.print("Hallo ");
System.out.print(name);
System.out.println("!");
}
public void russian()
{
System.out.print("Privet ");
System.out.print(name);
System.out.println("!");
}
public void chinese()
{
System.out.print("Ni hao ");
System.out.print(name);
System.out.println("!");
}
}
public class HelloTester
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
String name;
//Accepting the name
System.out.print("\nEnter your name: ");
name=input.next();
/creating an object of Hello class
Hello hello=new Hello(name);
System.out.println("\nGreeting in English: ");
System.out.println("-------------------------------------");
hello.english();
//calling the methods to greet in different languages
System.out.println("\nGreeting in Spanish: ");
System.out.println("-------------------------------------");
hello.spanish();
System.out.println("\nGreeting in French: ");
System.out.println("-------------------------------------");
hello.french();
System.out.println("\nGreeting in German: ");
System.out.println("-------------------------------------");
hello.german();
System.out.println("\nGreeting in Russian: ");
System.out.println("-------------------------------------");
hello.russian();
System.out.println("\nGreeting in Chinese: ");
System.out.println("-------------------------------------");
hello.chinese();
System.out.print("\n");
}
}
\\
So, the output is attached below:
Learn more about the topic Java Program:
https://brainly.com/question/19271625
Which holds all of the essential memory that tells your computer how to be
a computer (on the motherboard)? *
O Primary memory
Secondary memory
What is the use of the name box
in excel?
A program is written to compute the sum of the integers from 1 to 10. The programmer, well trained in reusability and maintainability, writes the program so that it computes the sum of the numbers from k to n. However, a team of security specialists scrutinizes the code. The team certifies that this program properly sets k to 1 and n to 10; therefore, the program is certified as being properly restricted in that it always operates on precisely the range 1 to 10.
Required:
List different ways that this program can be sabotaged so that during execution it computes a different sum, such as 3 to 20.
Answer:
See explanation
Explanation:
An instance of such program written in python is
isum = 0
for i in range(1,11):
isum = isum + i
print(sum)
One of the ways the program can give a wrong result is when someone alters the program source program before it's complied and executed.
Take for instance.
Changing
isum = 0 to isum = 4
will alter the result by additional 4
Another way is if an outside program or process alters the program execution.
in programming and flowcharting, what components should you always remember in solving any given problem?
Answer:
you should remember taking inputs in variables
Which step is first in changing the proofing language of an entire document?
A: Click the Language button on the Status bar.
B: Select the whole document by pressing Ctrl+A.
C: Under the Review tab on the ribbon in the Language group, click the Language button and select Set Proofing Language.
D: Run a Spelling and Grammar check on your document before changing the language.
Answer:
b) Select the whole document by pressing Ctrl+a.
Explanation:
The correct answer is b. If you do not select the whole document or parts of the document you wish to change the proofing language for, it will only be applied to the word your cursor is positioned in.
ig:ixv.mona :)
Answer:
B) Select the whole document by pressing Ctrl+A.
_____ is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation
Answer:
Continuous Improvement
Explanation:
Continuous Improvement is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation.
What is Continuous Improvement?W. Edwards Deming used the phrase "continuous improvement" to refer to general processes of improvement and to embrace "discontinuous" improvements, or many diverse ways addressing various topics.
A subset of continuous improvement, with a more narrow focus on linear, incremental change inside an already-existing process, is continuous improvement.
Some practitioners also believe that statistical process control techniques are more closely related to continuous improvement. Constant improvement, often known as continuous improvement, is the continued enhancement of goods, services, or procedures through both small-scale and significant advancements.
Therefore, Continuous Improvement is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation.
To learn more about Continuous Improvement, refer to the link:
https://brainly.com/question/15443538?
#SPJ3
Keisha has a worksheet with a range of cells using the following columns: Name, Score, Group, Study Group, and Date. Keisha needs to sort the worksheet on the Date field. Which option should she use to most efficiently complete this task?
A: Use the Cut and Paste option to reorganize the data to fit that order.
B: Use the Filter function to organize the data based on the date.
C: Use the Order function to organize the data based on the date.
D: Use the Sort function to organize the data based on date order.
Answer:
The answer is
d. Use the Sort function to organize the data based on date order.
Explanation:
Most accurate one.
The option that she should use to most efficiently complete this task is to use the Sort function to organize the data based on date order. The correct option is D.
What is a worksheet?It is "a piece of paper used to record work schedules, working hours, special instructions, etc. a sheet of paper used to jot down problems, ideas, or the like in draft form." A worksheet used in education could have questions for pupils and spaces for them to record their responses.
A single spreadsheet called an Excel Worksheet is made up of cells arranged in rows and columns. A worksheet always starts in row 1 and column A. A formula, text, or number can be entered into each cell. Additionally, a cell can point to a different cell on the same worksheet, in the same workbook, or in a different workbook.
Therefore, the correct option is D. Use the Sort function to organize the data based on date order.
To learn more about the worksheet, refer to the link:
https://brainly.com/question/1024247
#SPJ6
Which of the following is a post-secondary school?
A.
Community college
B.
Vocational school
C.
Four-year college
D.
All of the above
Answer:
D
Explanation:
Answer:
C.
Four-year college
Explanation:
How do the following technologies help you on your quest to become a digital citizen
Answer:
kiosks
Explanation:
It is generally believed that a digital citizen refers to a person who can skillfully utilize information technology such as accessing the internet using computers, or via tablets and mobile phones, etc.
Kiosks (digital kiosks) are often used to market brands and products to consumers instead of having in-person interaction. Interestingly, since almost everyone today goes shopping, consumers who may have held back from using digital services are now introduced to a new way of shopping, thus they become digital citizens sooner or later.
Behaving in an acceptable manner within a workplace environment is referred to as having
restraint
workplace etiquette
patience
experience
Answer:
Workplace Etiquette
Explanation:
Hope dis helps
Answer:
B) workplace etiquette
Explanation:
Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text.
Ex: If the input is: (see image attached)
my code is this one but i dont know what im doing wrong:
#include
using namespace std;
int main()
{
while (true)
{
string word;
if (word.compare("Quit")==0)
{
break;
}
else if (word.compare("quit")==0)
{
break;
}
int len=word.length();
cout = 0; i--)
{
cout << word[i];
break;
}
cout << endl << endl;
}
cout << "Thank You..!";
return 0;
}
Table of Contents
1 Introduction
2 Running sed
2.1 Overview
2.2 Command-Line Options
2.3 Exit status
3 sed scripts
3.1 sed script overview
3.2 sed commands summary
3.3 The s Command
3.4 Often-Used Commands
3.5 Less Frequently-Used Commands
3.6 Commands for sed gurus
3.7 Commands Specific to GNU sed
3.8 Multiple commands syntax
3.8.1 Commands Requiring a newline
4 Addresses: selecting lines
4.1 Addresses overview
4.2 Selecting lines by numbers
4.3 selecting lines by text matching
4.4 Range Addresses
5 Regular Expressions: selecting text
5.1 Overview of regular expression in sed
5.2 Basic (BRE) and extended (ERE) regular expression
5.3 Overview of basic regular expression syntax
5.4 Overview of extended regular expression syntax
5.5 Character Classes and Bracket Expressions
5.6 regular expression extensions
5.7 Back-references and Subexpressions
5.8 Escape Sequences - specifying special characters
5.8.1 Escaping Precedence
5.9 Multibyte characters and Locale Considerations
5.9.1 Invalid multibyte characters
5.9.2 Upper/Lower case conversion
5.9.3 Multibyte regexp character classes
6 Advanced sed: cycles and buffers
6.1 How sed Works
6.2 Hold and Pattern Buffers
6.3 Multiline techniques - using D,G,H,N,P to process multiple lines
6.4 Branching and Flow Control
6.4.1 Branching and Cycles
6.4.2 Branching example: joining lines
7 Some Sample Scripts
7.1 Joining lines
7.2 Centering Lines
7.3 Increment a Number
7.4 Rename Files to Lower Case
7.5 Print bash Environment
7.6 Reverse Characters of Lines
7.7 Text search across multiple lines
7.8 Line length adjustment
7.9 Reverse Lines of Files
7.10 Numbering Lines
7.11 Numbering Non-blank Lines
7.12 Counting Characters
7.13 Counting Words
7.14 Counting Lines
7.15 Printing the First Lines
7.16 Printing the Last Lines
7.17 Make Duplicate Lines Unique
7.18 Print Duplicated Lines of Input
7.19 Remove All Duplicated Lines
7.20 Squeezing Blank Lines
8 GNU sed’s Limitations and Non-limitations
9 Other Resources for Learning About sed
10 Reporting Bugs
Appendix A GNU Free Documentation License
Concept Index
Command and Option Index
Next: Introduction, Up: (dir) [Contents][Index]
GNU sed
This file documents version 4.8 of GNU sed, a stream editor.
Copyright © 1998–2020 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.
• Introduction: Introduction
• Invoking sed: Invocation
• sed scripts: sed scripts
• sed addresses: Addresses: selecting lines
• sed regular expressions:
Explanation:
C++
12.18 Lab - Structs
In this lab, you will familiarize yourself with structs through a small exercise. We will be mixing the RGB values of colors together to make a new one.
RGB stands for red, green and blue. Each element describes the intensity value ranging from 0 - 255. For example: black color will have RGB values (0, 0, 0) while white will have (255, 255, 255).
Create an array of structs color. The struct contains three integers named red, green and blue. This corresponds to the RGB values of a color. For each array element, ask the user to enter the intensity value of red, green and blue. The value should be between 0 and 255 (inclusive).
*********The user can enter at most 10 colors. ********. see below for inputs
Additionally, compute the average of each of the red, green and blue components. For code modularity, implement a function that returns the average of each rgb component in your dynamic array. The function (called average) should take in a struct array, the rgb type for which you want to compute the average (as a string - red, blue or green) and its length. Print out the final result in the form (r, g, b), where r, g, b corresponds to each averaged value.
Can you guess what color you mixed? (Note: Your program does not need to print the final color mixed)
TEST #1
Input ------->>> 0 0 2 2 4 2
Expected output ----->>>> (1, 2, 2)
TEST #2
Input ------>>> 245 220 5 43 56 21 234 56 43
Expected output ----->>>> (174, 110, 23)
TEST #3
Input ------->>> 225 221 2 43 56 21 224 56 43 120 110 24 25 25 27
Expected output ----->>>> (127, 93, 23)
TEST #4
Input -------->>> 245 22 34
Expected output ----->>>> (245, 22, 34)
In order to input values choose between 0 up till 255 (integers)
Output
Number of colors to be analized: 2
Write the amounts of RGB: 1:
Red: 10
Green: 20
Blue: 100
Write the amounts of RGB: 2:
Red: 30
Green: 20
Blue: 19
The colors average: (20, 20, 59)
...Program finished with exit code 0
Press ENTER to exit console.
Code
#include <iostream>
using namespace std;
//declaration of variables
typedef struct Color {
int b,r,g; //integers values which define a digital color
} Color;
//function of average
int average(Color *colors, int size, char type) {
int s = 0;
for(int i=0; i<size; i++) {
if(type=='b') {
s += colors[i].b;
}
if(type=='g') {
s += colors[i].g;
}
if(type=='r') {
s += colors[i].r;
}
}
return s/size;
}
int main() {
int n;
cout << "Number of colors to be analized: ";
cin >> n;
Color *colors = new Color[n];
for(int i=0; i<n; i++) {
cout << "Write the amounts of RGB: " << (i+1) << ":\n";
cout << "Red: ";
cin >> colors[i].r;
cout << "Green: ";
cin >> colors[i].g;
cout << "Blue: ";
cin >> colors[i].b;
cout << endl;
}
cout << "The colors average: ";
cout << "(" << average(colors, n, 'r') << ", " << average(colors, n, 'g');
cout << ", " << average(colors, n, 'b') << ")\n";
}
which of these are the largest.a exabyte,,terabyte,,gigabyte or kilobyte
Answer:
I think a exabyte, if not its probably a terabyte
Explanation:
Write a program named palindromefinder.py which takes two files as arguments. The first file is the input file which contains one word per line and the second file is the output file. The output file is created by finding and outputting all the palindromes in the input file. A palindrome is a sequence of characters which reads the same backwards and forwards. For example, the word 'racecar' is a palindrome because if you read it from left to right or right to left the word is the same. Let us further limit our definition of a palindrome to a sequence of characters greater than length 1. A sample input file is provided named words_shuffled. The file contains 235,885 words. You may want to create smaller sample input files before attempting to tackle the 235,885 word sample file. Your program should not take longer than 5 seconds to calculate the output
In Python 3,
MY CODE: palindromefinder.py
import sys
def is_Palindrome(s):
if len(s) > 1 and s == s[::-1]:
return true
else:
return false
def main():
if len(sys.argv) < 2:
print('Not enough arguments. Please provide a file')
exit(1)
file_name = sys.argv[1]
list_of_palindrome = []
with open(file_name, 'r') as file_handle:
for line in file_handle:
lowercase_string = string.lower()
if is_Palindrome(lowercase_string):
list_of_palindrome.append(string)
else:
print(list_of_palindrome)
If you can adjust my code to get program running that would be ideal, but if you need to start from scratch that is fine.
Open your python-3 console and import the following .py file
#necessary to import file
import sys
#define function
def palindrome(s):
return len(s) > 1 and s == s[::-1]
def main():
if len(sys.argv) < 3:
print('Problem reading the file')
exit(1)
file_input = sys.argv[1]
file_output = sys.argv[2]
try:
with open(file_input, 'r') as file open(file_output, 'w') as w:
for raw in file:
raw = raw.strip()
#call function
if palindrome(raw.lower()):
w.write(raw + "\n")
except IOError:
print("error with ", file_input)
if __name__ == '__main__':
main()
What is one reason to create a study check list
The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values and goes from a force of 0, which is no wind, up to 12, which is a hurricane. The following script first generates a random force value. Then, it prints a message regarding what type of wind that force represents, using a switch statement. You are to rewrite this switch statement as one nested 150 CHAPTER 4: Selection Statements if-else statement that accomplishes exactly the same thing. You may use else and/or elseif clauses.
ranforce = randi([0, 12]); switch ranforce case 0 disp('There is no wind') case {1,2,3,4,5,6} disp('There is a breeze') case {7,8,9} disp('This is a gale') case {10,11} disp('It is a storm') case 12 disp('Hello, Hurricane!') end
Answer:
ranforce = randi([0, 12]);
if (ranforce == 0)
disp('There is no wind')
else if(ranforce>0 && ranforce <7)
disp('There is a breeze')
else if(ranforce>6 && ranforce <10)
disp('This is a gale')
else if(ranforce>9 && ranforce <12)
disp('It is a storm')
else if(ranforce==12)
disp('Hello, Hurricane!')
end
Explanation:
Replace all switch case statements with if and else if statements.
An instance is:
case {7,8,9}
is replaced with
else if(ranforce>9 && ranforce <12)
All other disp statements remain unchanged