Answer:
def index(elem, seq):
for i in range(len(seq)):
if elem == seq[i]:
return i
return len(seq)
print(index(5, [4, 10, 8, 5, 3, 5]))
Explanation:
Create a function named index that takes elem and seq as parameters
Create a for loop that iterates through the seq. If elem is equal to the item in the seq, return the i, index of the item.
If the elem is not found in the seq, this means nothing will be returned in the loop, just return the length of the seq, len(seq)
Call the function with given parameters and print the result
Note: Since 5 is in the list in the example, the index of the 5 which is 3 will be returned
In this exercise we have to use the knowledge of computational language in Python, so we have that code is:
It can be found in the attached image.
What is an index in Python?An index, in your example, refers to a position within an ordered list. Python strings can be thought of as lists of characters; each character is given an index from zero to the length minus one.
So, to make it easier, the code in Python can be found below:
def index(elem, seq):
for i in range(len(seq)):
if elem == seq[i]:
return i
return len(seq)
print(index(5, [4, 10, 8, 5, 3, 5]))
See more about python at brainly.com/question/26104476
HEY DO U LIKE TRAINS!
Answer:
yes
Explanation:
yes
Which of the following is true of both copyrights and trademarks?
a.) Both are granted for an unlimited period of time
b.) Both must be applied for and granted by the government
c.) Both provide protection of intellectual property to the owner
D.) Both are registered with the government
Answer:
C.
Explanation:
A trademark protects stuff like symbols or logos, and copyrights protect an idea or composure. Both protect intellectual property
Answer:
C
Explanation:
Did it on ed2020
12. Write C statement(s) that accomplish the following. a. Declare int variables x and y. Initialize x to 25 and y to 18. b. Declare and initialize an int variable temp to 10 and a char variable ch to 'A'. c. Update the value of an int variable x by adding 5 to it. d. Declare and initialize a double variable payRate to 12.50. e. Copy the value of an int variable firstNum into an int variable tempNum. f. Swap the contents of the int variables x and y. (Declare additional variables, if necessary.) g. Suppose x and y are double variables. Output the contents of x, y, and the expression x 12 / y - 18. h. Declare a char variable grade and set the value of grade to 'A'. i. Declare int variables to store four integers. j. Copy the value of a double variable z to the nearest integer into an int variable x.
Answer:
a.
int x = 25;
int y = 18;
b.
int temp = 10;
char ch ='a';
c.
x += 5;
d.
double payRate = 12.5;
e.
int tempNum = firstNum;
f.
int tempp = x;
x = y;
y = tempp;
g.
printf("Value of x = %f\n",x);
printf("Value of y = %f\n",y);
printf("Arithmetic = %f\n",(x + 12/y -18));
h.
char grade = 'A';
i.
int a,b,c,d;
a = 5; b = 2; c = 3; d = 6;
j.
int x = round(z);
Explanation:
The answers are straight forward.
However, I'll give a general hint in answering questions like this.
In C, variable declaration is done by:
data-type variable-name;
To declare and initialise the variable, you do;
data-type variable-name = value;
So, for questions that requires that we declare and initialise a variable, we make use of the above syntax..
Take (a) for instance:
int x = 25;
int y = 18;
Same syntax can be applied to (b), (d), (e), (h) & (I)
For question (c);
This can be done in two ways;
x = x + 5;
Or
x+=5;
Both will give the same result.
For question (f):
We start by initialise a temporary variable that stores x.
Then we store the value of x in y.
Then we store the content of the temporary variable to y.
This swaps the values of x and y
For question (g):
When printing a double variable in C, we make use of '\f' as a string format
For question (j):
The round function is used to round up a double variable to integer.
Java Eclipse homework. I need help coding this
Project Folder: Lesson 03
package: challenge3B
Class: ChallengeProject3B
Complete the code challenge below.
(You will need to use escape sequences to print the \ and “ characters )
Write a program that displays the following:
1. Write code that displays your name inside a box on the console screen, like this:
+-----------------+
| Your Name |
+-----------------+
2. Write code that prints a face, using text characters, hopefully better looking than this one:
//////
| o o |
(| ^ |)
| \_/ |
-------
3. Write code that prints a tree:
/\
/ \
/ \
/ \
--------------
“ “
“ “
“ “
public class ChallengeProject3B{
public static void main(String [] args){
System.out.println("+-----------------+");
System.out.println("| YOURNAME |");
System.out.println("+-----------------+");
System.out.println("\n//////");
System.out.println("| o o|");
System.out.println("|\\_/|");
System.out.println("-----");
System.out.println("\n/\\");
System.out.println("/\\");
System.out.println("/\\");
System.out.println("/\\");
System.out.println("--------------");
}
}
I hope this helps!
give the synyax and example of any three mathematical functions in spreadsheet
Answer:
The answer to this question is given below in the explanation section
Explanation:
There are different mathematical functions that can be used in the spreadsheet for performing some required calculations on data such as taking the average of numbers, adding numbers, multiplying the numbers.
But most commonly used three mathematical functions in the spreadsheet is given below:
1. AVERAGE(): The average function is used to find the average of a given number of cells.
Syntax of Average() function: average(number1, number2,.....).
2. SUM(): The sum function is used to add all the values within a range of cells.
Syntax: of sum() function: sum(cell address1: cell address2)
3.COUNT(): Count () function is used to count the number of data.
Syntax of Count() function: count(cell address1: cell address2)
Sukhi needs to insert a container into her form to collect a particular type of information. Which object should she insert?
text box
form field
field code
image
Answer:
text box
Explanation:
When it comes to collecting information such as the user's name, telephone number, address, etc., it is important to insert a text box into the form field. This can be done in several ways, such as giving the user the freedom to type her own response in the text box or making it "pre-filled." A text box with pre-filled value means that the user cannot type anything in the box because it has an existing value (default value). The text box may also give a "hint" in order to let the user know of possible values he can choose.
Answer:
A- text box
Explanation: ;)
What steps should a user take to create a secondary address book?
Open the Backstage view and Account Settings.
Open the Backstage view, and click People options.
Open the People view, and click New Address Book.
Open the People view, click Folder tab, and click New Folder.
Answer:
It's A
Explanation:
correct on edg
Answer:
A is correct on edg
Explanation:
Write a method that will receive 2 numbers as parameters and will return a string containing the pattern based on those two numbers. Take into consideration that the numbers may not be in the right order.
Note that the method will not print the pattern but return the string containing it instead. The main method (already coded) will be printing the string returned by the method.
Remember that you can declare an empty string variable and concatenate everything you want to it.
As an example, if the user inputs "2 5"
The output should be:
2
3 3
4 4 4
5 5 5 5
Answer:
The purpose of the Java compiler is to translate source code into instructions public static void main(String[] args) Arity is the number of arguments passed to a constructor or method or the number ... and objects, which are the focus of object-based programs. Remove the 2 from between the square brackets to make.
Explanation:
Declare Integer values[SIZE] = 1, 2, 3, 4, Debugging Exercises 1. What is the error in the following pseudocode? // This program uses an array to display five names Constant Integer SIZE = 5 Declare String names [SIZE] = "Meg", "Jack", "Steve "Bill", "Lisa" Declare Integer index For index = 0 To SIZE Display names[index] End For
Answer:
In "Declare String names [SIZE] =", Meg and Jack are done correctly, however for Steve and Bill, there is no ending quote after Steve, and no comma separating the two. More of a common problem than one would think
it should look more like
Declare String names [SIZE] = "Meg", "Jack", "Steve", "Bill", "Lisa"
essay regarding a magic cell phone that turns into robot
It should be noted that when writing an essay, it's important to effectively present the information to the readers.
Writing an essay.When writing the essay, the following steps are required:Create an essay outline.It's important to also develop a thesis statement.Introduce the topic.Then, write the body of the message The conclusion should be presented.It should be noted that when writing the essay, it's also important to integrate the evidence clearly and ensure that the grammar used is correct.
Learn more about essays on:
https://brainly.com/question/25607827
5.24 LAB: Two smallest numbers Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input begins with an integer indicating the number of integers that follow. You can assume that the list will have at least 2 integers and less than 20 integers. Ex: If the input is: 5 10 5 3 21 2 the output is: 2 3 To achieve the above, first read the integers into an array. Hint: Make sure to initialize the second smallest and smallest integers properly. 265236.1527390
Answer:
Here is the C++ program:
#include <iostream> //to use input output function
#include <vector> //to use vectors
using namespace std; //to identify objects like cin cout
int main() { //start of main method
int size, number; //to store size of list and input numbers
cout<<"Enter list size: "; //prompts user to enter size of the list
cin >> size; //reads list size from user
vector<int> v; //creates a vector named v
for (int i = 0; i < size; ++i) { //iterates till the size of list reaches
cin >> number; //reads the input numbers
v.push_back(number); } //push number into a vector from the back
int num1 = v[0], num2 = v[1], current , temp; //num1 is set to the element at 0-th position of v and num2 is set to be on 1st index of v
if (num1 > num2) { //if num1 is is greater than num2
temp = num1; //assigns value of num1 to temp
num1 = num2; //assigns value of num2 to num1
num2 = temp; } //assigns value of temp to num2
for (int i = 2; i < size; ++i) { //iterates size times
current = v[i]; //set current to the i-th index of v
if (current < num1) { //if current is less than num1
num2 = num1; //assigns value of num1 to num2
num1 = current; } //assigns value of current to num1
else if(current < num2) { //if value of current is less than num2
num2 = current; } } //assigns value of current to num2
cout<<num1<< " "<<num2<< endl; } //dispalys num1 and num2 i.e. two smallest integers in ascending order
Explanation:
I will explain the program with an example.
Lets say the list size is 4 and numbers are 1 2 3 4
for (int i = 0; i < size; ++i)
This loop reads each number (1,2,3,4) and adds that number to the vector v which is the sequence container. The method push_back is used which inserts each number into the vector at the end, after the current last number and the vector size is increased by 1.
Next num1 = v[0] becomes num1 = 1
and num2 = v[1] becomes num1 = 2
if (num1 > num2) this condition is false so program moves to the statement:
for (int i = 2; i < size; ++i)
current = v[i]; becomes current = v[2]; which is current = 3
if (current < num1) is false so program moves to :
else if(current < num2) this is also false.
So the program moves to the statement:
cout<<num1<< " "<<num2<< endl;
which prints these two numbers 1 and 2 on output screen as the two smallest integers in the list in ascending order. Hence the output of the program is:
1 2
The screenshot of output of the program is attached.
Answer:
integers=[]
while True:
number=int(input())
if number<0:
break
integers.append(number)
print("",min(integers))
print("",max(integers))
Explanation:
You should avoid storing files and folders on the blank
Answer:
why
Explanation:
differences between laptop andhandheld conputer
Answer: a conputer has a moniter and a mouse and laptop doesn't
Explanation:
The graphical user interface (GUI) was pioneered in the mid-1970s by researchers at:
A) Apple Computer
B) Microsoft
C) Xerox
D) IBM
Answer:
its C actually
Explanation:
C) Xerox plus i had a quiz
Answer:
xerox
Explanation:
What is the solubility of an empty soda can
Answer:
Around 2.2 grams.
Explanation:
2.2 g CO2∗1 mol CO244 g CO2=0.05 mol
355 mL∗1 L1000 mL=0.355 L
So here we can see we have about 0.05 mol/0.355 L or about 0.14 mol of carbon dioxide per liter of soda. Of course this value varies by manufacturer, type of drink, container, etc.
2
Select the correct answer from each drop-down menu.
Different web browsers perform similar
functions, which are presented in the form of?
A. Text labels
B. Webpages
C. Buttons and menus
Answer:
The answer to this question is given below in the explanation section.
Explanation:
The correct answer to this question is B.
Because different browsers perform similar functions that are presented in the form of webpages. If you want to run the webpage in chrome, it will run similarly as you run it in internet explorer or in firefox.
However, other options such as text labels and buttons and menus are not the browser functions because these are the elements of the webpages.
so the correct answer to this question is webpages.
Given code
#include
#include
using namespace std;
bool weHaveWinner(int a,int b)
{
return (a>=21 && b>=21 && abs(a-b)>1);
}
int main()
{
int aPoints = 0;
int bPoints = 0;
string input;
// ToDo: Write a loop until input is "end" or we have a winner
// the loop should read the input and add a point to aPoints if "A"
// or add a point to bPoints if "B", don't do anything but leave the
// loop if "end"
while(1)
{
cin >> input;
if(input=="end")
break;
if(input=="A")
aPoints++;
if(input=="B")
bPoints++;
if(weHaveWinner(aPoints,bPoints))
break;
}
// Tell the user if we have a winner or not
if(aPoints > bPoints + 1 && aPoints >= 21)
{
cout aPoints + 1 && bPoints >= 21)
{
cout << "Team B won! (" << aPoints << "-" << bPoints << ")" << endl;
}
else
{
cout << "Game ended as a draw. (" << aPoints << "-" << bPoints << ")" << endl;
}
return 0;
}
Answer:
YES
Explanation:
Answer:
yeet
Explanation:
yeet
Given four values representing counts of quarters, dimes, nickels and pennies, output the total amount as dollars and cents. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("Amount: $%.2f\n", dollars); Ex: If the input is: 4 3 2 1 where 4 is the number of quarters, 3 is the number of dimes, 2 is the number of nickels, and 1 is the number of pennies, the output is: Amount: $1.41 For simplicity, assume input is non-negative.
LAB ACTIVITY 2.32.1: LAB: Convert to dollars 0/10 LabProgram.java Load default template. 1 import java.util.Scanner; 2 3 public class LabProgram 4 public static void main(String[] args) { 5 Scanner scnr = new Scanner(System.in); 6 7 /* Type your code here. */|| 8 9) Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box Enter program input (optional) If your code requires input values, provide them here. Run program Input (from above) 1 LabProgram.java (Your program) Output (shown below) Program output displayed here
Answer:
Replace /* Type your code here. */ with the following lines of code
int quarter =scnr.nextInt();
int dime = scnr.nextInt();
int nickel = scnr.nextInt();
int penny = scnr.nextInt();
double dollars = quarter * 0.25 + dime * 0.1 + nickel * 0.05 + penny * 0.01;
System.out.printf("Amount: $%.2f\n", dollars);
System.out.print((dollars * 100)+" cents");
Explanation:
The next four lines declare the given currencies as integer
int quarter =scnr.nextInt();
int dime = scnr.nextInt();
int nickel = scnr.nextInt();
int penny = scnr.nextInt();
This line calculates the amount in dollars
double dollars = quarter * 0.25 + dime * 0.1 + nickel * 0.05 + penny * 0.01;
The next two lines print the amount in dollars and cents respectively
System.out.printf("Amount: $%.2f\n", dollars);
System.out.print((dollars * 100)+" cents");
Given four values representing counts of quarters, dimes, nickels and pennies, the total amount in dollars and cent can be represented as follows;
#1 quarters = 0.25 dollars
#1 dime = 0.1 dollar.
#1 nickel = 0.05 dollars
#1 penny = 0.01 dollars
#quarters, dimes, nickels and pennies,
x = input("write your input here: ")
for i in x:
quarters = 0.25*float(x[0])
dime = 0.1*float(x[1])
nickel = 0.05*float(x[2])
penny = 0.01*float(x[3])
sum1 = quarters + dime + nickel + penny
print(round(sum1, 2))
Code explanation:The commented section of the code is just the conversion rate of quarters, dime, nickel and penny to dollars.
Variable x is used to store the user's input.Then, we loop through the users inputThen multiply each looped value by it conversion rate to dollars.Finally, we sum the values and print the sum rounded to 2 decimal places as required.learn more on python code here: https://brainly.com/question/24556911?referrer=searchResults
After applying transitions to his presentation, Omar uses the Slide Show feature to view the them. He notices that the transitions he applied do not occur between all the slides.
Which step did Omar forget to do?
Right-click the mouse.
Press the OK button.
Click the Apply To All button.
Uncheck the On Mouse Click box.
Answer:
Its C
Explanation:
On Edg
Answer: Click the apply to all button
Explanation:
______ means locating a file among a set of files
Locating a file among set of flies is called file system.
A standard core of rules or specification is beneficial because ____.
A. all programmers involved in with a product can follow the same guidelines
B. A variety of styles is the best for the final part
C. Everyone’s code style is followed
D. Style changes with different subject matter
Answer:
The answer to this question is given below in the explanation section. However, the correct answer is A.
Explanation:
A standard core of rules or specification is beneficial because ____.
A. all programmers involved in with a product can follow the same guidelines
B. A variety of styles is the best for the final part
C. Everyone’s code style is followed
D. Style changes with different subject matter
The correct answer is
A standard core of rules or specification is beneficial because all programmers involved in with a product can follow the same guidelines .
Other options are not correct because a variety of styles is not prefered and used in software development, and everyone's code style can not be followed easily. Because programming style changes with different programmers, so it would not easy for other programmer to read and understand the code.
As a producer you are willing to supply the most goods at the highest price this is because the highest price earns you the
Answer:
most money
Explanation:
common sense
Please Help Me
What kinds of solutions are proposed for different IT issues, and what are their advantages and disadvantages?
Answer:
There are three basic forms of business ownership: sole proprietorship, partnership and corporation. Each of these forms of business organization has advantages and disadvantages in such areas as setting up the company, paying taxes and assessing liability for business debts
Ken has inserted an image into his PowerPoint presentation, but the image contains a lot of empty and/or unnecessary space. He needs to eliminate this space. Which option should he use to achieve this goal?
cut
copy
crop
adjust
Answer:
C. crop
Explanation:
Answer:
c
Explanation:
What is the output of the following program?
S = "foo"
t = "bar"
print(((s+t)*3).count("barf"))
The output of the following program is 2.
What is output of this program?S = "foo"
t = "bar"
print(((s+t)*3).count("barf"))
here we get The output is 2
Information that is processed and sent out by a program or another electronic device is considered its output. The output is anything that is audible on the display screen, such as the words you type on the keyboard.The term "output" refers to any data that a computer or other electronic device processes and sends. Anything that can be seen on a computer screen, such as the text you write on a keyboard, is an example of output.To learn more about output refer to:
https://brainly.com/question/27646651
#SPJ2
Which change should she make in her outline?
Change Step 2 to “Click the Format tab.”
Change Step 3 to “Open the Chart Title dialog box.”
Change Step 4 to “Type in the chart title.”
Change Step 5 to “Add the Chart Title.”
Answer:
A
Explanation:
Two Smallest (20 points). Write a program TwoSmallest.java that takes a set of double command-line arguments and prints the smallest and second-smallest number, in that order. It is possible for the smallest and second-smallest numbers to be the same (if the sequence contains duplicate numbers). Note: display one number per line. Hint: Double.MAX_VALUE is the largest real number that can be stored in a double variable. java TwoSmallest 17.0 23.0 5.0 1.1 6.9 0.3 0.3 1.1 java TwoSmallest 1.0 35.0 2.0 1.1 6.9 0.3 0.3 6.7 0.3 0.3
Answer:
Written in Java
import java.util.*;
public class Main {
public static void main(String args[]) {
int n;
Scanner input = new Scanner(System.in);
n = input.nextInt();
double nums []= new double [n];
for (int i=0; i<n;i++)
{
nums[i] = input.nextDouble();
}
Arrays.sort(nums);
System.out.println("The two smallest are: ");
for (int i=0; i<2;i++)
{
System.out.println(nums[i]);
}
}
}
Explanation:
This line declares number of input
int n;
This line calls the Scanner function
Scanner input = new Scanner(System.in);
This line gets input from user
n = input.nextInt();
This line declares an array of n elements
double nums []= new double [n];
The following iteration gets input into the array
for (int i=0; i<n;i++)
{
nums[i] = input.nextDouble();
}
This line sorts the array
Arrays.sort(nums);
The following iteration prints the two smallest
System.out.println("The two smallest are: ");
for (int i=0; i<2;i++)
{
System.out.println(nums[i]);
}
Let T be the statement: The sum of any two rational numbers is rational. Then T is true, but the following "proof is incorrect. Find the mistake. "Proof by contradiction: Suppose not. That is, suppose that the sum of any two rational numbers is not rational. This means that no matter what two rational numbers are chosen their sum is not rational. Now both 1 and 3 are 1/1 and 3 3/1, and so both are ratios of integers with rational because 1 a nonzero denominator. Hence, by a supposition, the sum of 1 and 3, which is 4, is not rational. But 4 is rational because 4 4/1 , which is a ratio of integers with a nonzero denominator. Hence 4 is both rational and not rational, which is a contradiction. This contradiction shows that the supposition is false and hence statement T is true.
Answer:
the mistake is in the first statement.
Explanation:
Now lets us put the statement into consideration:
"The sum of any two rational numbers is irrational"
The negation is: " there exists a pair of rational numbers whose sum is irrational". (Existence of at least one of such a pair).
The negation is not "the sum of any two rational numbers is irrational"
Therefore the mistake is in the first statement and it is due to incorrect negation of the proof.
Q10: You cannot rename a compressed folder.
Click slowly twice the folder.
Right click and choose rename.
The early success of Microsoft was cemented by the release of which software product:
A) Altair BASIC
B) MS-DOS for the IBM PC
C) IBM’s OS/360
D) P/M
Answer:
MS-DOS for the IBM PC
Explanation:
Shortly after its launch most personal computer companies adopted MS-DOS as their operating system.
Answer:
basically B
Explanation:
the person above is correct