while True:
number = int(input("input the number: "))
exponent = int(input("input the exponent : "))
if number == 0:
break
else:
result = 1
while exponent != 0:
result *= number
exponent-=1
print("Answer = " + str(result))
we are asked not to use the power function of python. The question wants us to use a for or a while loop to compute the power.
The while loop makes sure the user is always asked to input the number and an exponent.
If the users number equals 0, the while loop will break.
Else the code will find the power of the number.
Finally, we print the answer if the user number is not zero
The bolded part of the code are python keywords.
read more: https://brainly.com/question/12992668?referrer=searchResults
Given a variable that contains mixed collection types, update the provided function to display the first inital and last name of the instructor:
Update the function to accept a list and the name of the instructor you wish to find.
Update the function to reformat the name of the instructor and return it back to the calling program.
If the instructors name is entered as John Smith then the function should return back J. Smith
If the instructors name is entered as Tracy Anne Rios then the function should return back T. Rios
If the instructors name is entered as Jackson then the function should return back Jackson
Add in any exception handling for the following scenarios:
Exceptions related to accessing the list or dictionary should output the message: Instructor not found.
All other exceptions should output the message: An error has occurred.
Test to ensure the program passes the provided test cases found in the TESTS.md file
Hints
You may only use a try/except block, no if statements
Figure out how to use only one return in the method
Tests.md:
Input
Amy Williams
Output
A. Williams
Case 2
Input
Sarah Jane Smith
Output
S. Smith
Case 3
Input
Thomas Tom
Output
Instructor not found.
What i have so far
#!/usr/bin/env python3
# Discussion 10.2: Collection Type Exceptions
# Task 1. Modify Functions for Names
def get_initial_name(initials, name):
list = instructor_name.split(' ') # this function returns a list
try:
initial = list[0][0]
name = list[-1]
f_name = initial + '. ' + name
except:
return 'Instructor not found'
# DO NOT MODIFY BELOW
if __name__ == "__main__":
courses = [
{ "name": "Amy Andrews", "courseName": "Math I", "units": 3 },
{ "name": "Bryan Bravo", "courseName": "English I", "units": 3},
{ "name": "Charles Chavez", "courseName": "Physics I", "units": 3 },
{ "name": "Daniel Diaz", "courseName": "Chemistry I", "units": 3 },
{ "name": "Edgar Allen Elam", "courseName": "Math II", "units": 3 },
{ "name": "Felicia Farr", "courseName": "Music I", "units": 3 },
{ "name": "GarthGarcia", "courseName": "Physical Education I", "units": 3 }
]
# Take Input
instructor_name = input("> ")
# Output the Result
print(get_initial_name(courses, instructor_name))
In your own words, explain the process undertaken while testing the significance of a multiple linear regression model parameter Indicating clearly the hypothesis considered, test statistics used rejection criteria and conclusion.
#include
void main()
{
int m=45,first,last;
first=m/10;
last=m%10;
printf("%d",first);//line 1
printf("\n%d",last);//line 2
printf("\nSum=%d",first*last);//line 3
printf("\n%d",first*last);//line 4
printf("\n%d",last*last);//line 5
printf("\nCube=%d",first*first*first);//line 6
}
Select the correct output for line 1 ~
1 point
4
5
0
Answer:
4
Explanation:
45 divided by 10 using integer division is 4
I ran the program, output is below.
explain how you activate window explore
Answer:
Win+R -> Type "explorer.exe" -> Press enter
What does “The Principle of Least Privilege” mean as applied to security?
Answer:
The principle of least privilege (PoLP) refers to an information security concept in which a user is given the minimum levels of access – or permissions – needed to perform his/her job functions. ... Least privilege enforcement ensures the non-human tool has the requisite access needed – and nothing more.
Explanation: let me know if this helps!
Which tab must be enabled to access the VBA Editor?
O Developer
O Insert
O Review
O View
The answer to your question is Developer.
Consider the following class. public class ClassicClass { private static int count = 0; private int num; public ClassicClass() { count++; num = count; } public String toString() { return count + " " + num; } } What is printed when the following code in the main method of another class is run? ClassicClass a = new ClassicClass(); ClassicClass b = new ClassicClass(); ClassicClass c = new ClassicClass(); System.out.println(a + ", " + b + ", " + c);
The the code in the main method is run, it will print
"3 1, 3 2, 3 3"
The static/class field count stores the number of instances of the class created. count is always incremented when the instance constructor is called.
The instance field num acts like an identifier/serial number for the instance created. When the constructor is called, the current count is stored in the num field of the instance.
Each instance's toString( ) method will output the total count (from count) and the serial of the instance (from num).
When the code runs in the main method, it creates three instances (making count==3), so that we have
a = {count: 3, num: 1}b = {count: 3, num: 2}c = {count: 3, num: 3}and implicitly calls toString( ) in the println method for each of the three instances to produce the following output
"3 1, 3 2, 3 3"
Learn more about programs here: https://brainly.com/question/22909010
identify another natural cyclic event, other than phases and eclipses, that is caused by the moon's gravitational pull on earth
Answer:
TEKS Navigation
Earth Rotation.
Moon Phases.
Tides.
Cyclical events happen in a particular order, one following the other, and are often repeated: Changes in the economy have followed a cyclical pattern. an example would be pamdemic and vircus it is belived that a new pamdemic starts every 100 years.
Explanation:
The rise and fall of ocean tides is the natural cyclic event caused by the moon's gravitational pull on earth
The gravitational pull of the moon's causes the two bulges of water on the Earth's oceans:
where ocean waters face the moon and the pull is strongestwhere ocean waters face away from the moon and the pull is weakestIn conclusion, the rise and fall of ocean tides is the natural cyclic event caused by the moon's gravitational pull on earth
Read more about gravitational pull
brainly.com/question/856541
Pre-Test: Players on EverQuest II encounter Pizza Hut stores and can even order a pizza in real life using an in-game command. This is an example of
EverQuest II case is an example of a transactional ad.
What is transactional ad?
A transactional advertisement is a method of completing a financial transaction through an advertisement, without the need for the user / buyer to travel to the store.
Why does the example classify as transactional ad?
The EverQuest II case is an example of transactional ad because they implemented a command for players to complete a transaction (the purchase of a pizza) through an in-game command without having to go to the pizza shop.
Learn more about videogames in: https://brainly.com/question/11274464
Each road is associated with a value indicating the level of danger in maintaining that road during winter months. There are many subsets of roads such that the roads in such subsets keep the towns connected directly or indirectly. Each subset is assigned a cost of maintenance, which is directly proportional to the highest danger level of the road present in that subset. The engineer wants to select the smallest subset that keeps the towns connected directly or indirectly and that also has the lowest cost of maintenance. Develop an algorithm to find such a subset. Justify the correctness of your algorithm and derive its runtime.
Answer:
Each road is associated with a value indicating the level of danger in maintaining that road during winter months. There are many subsets of roads such that the roads in such subsets keep the towns connected directly or indirectly.
Today we see the advantages as well as disadvantages of a wired network. In comparison what technology would you recommend Wired Ethernet or a Wireless network technology for home and what would you recommend for business? Explain your answer
Answer:
wired network
Explanation:
Wired networks are generally much faster than wireless networks. ... This is mainly because a separate cable is used to connect each device to the network with each cable transmitting data at the same speed. A wired network is also faster since it never is weighed down by unexpected or unnecessary traffic.
hope that helps your welcome
11.23. Sort the words in a sentence Define a function called sorted_word_list, which takes a sentence (a string) as a parameter. Complete the function to make and return a list of the words in the sentence in sorted order.
The function to make and return a list of the words in the sentence in sorted order is as follows:
def sorted_word_list(x):
sorted_characters = sorted(x)
return list(sorted_characters)
print(sorted_word_list("string"))
The code is written in python .
We declared a function named sorted_word_list with a parameter x. The parameter accept a string.
sorted_characters is a variable that stores the sorted strings.
Then we return a list of the sorted string using the return statement.
Finally, we call the function using the print statement.
The values that are bolded in the code are python keywords.
read more: https://brainly.com/question/13973680?referrer=searchResults
Sebutkan contoh komputer analog, komputer digital, dan komputer hybrid
Answer: the examples of analog computer is voltmeter
Example of digital computer is tablet,mobile etc
Example of hybrid computer is digital meters used nowadays in cars etc
Problem: For multi access control, there are two approaches, those based on channel partitioning, and those based on random access. In packet switching, there are two rather similar approaches as well, namely, circuit switching and package switching. Discuss the similarities and differences in these two problem domains and the corresponding approaches g
The similarity between the two systems is the ability to connect many different communication devices and transfer data between a sender and a receiver. The main difference is the need for a connection for both to work.
We can arrive at this answer because:
Circuit and package quotation is very important for the connections of different communication devices.Furthermore, these two systems are used efficiently when a data transfer is required.However, even being used for the same purposes, they have many differences between them.The biggest difference is the need for a connection, as package switching is done without the need for a connection, while circuit switching needs a connection to act.In addition, circuit switching is more widely used because of its ability to transfer data from one point to another via message transfer, while package switching is used when circuit switching is not available as it does the sending data more slowly across one drive.
More information:
https://brainly.com/question/7227504
6-Write a BNF description of the precedence and associativity rules defined for the expressions in Problem 9 - chapter 7 of the textbook . Assume the only operands are the names a,b,c,d, and e.
The BNF description, or BNF Grammar, of the precedence and associativity rules are
[tex]<identifier>\text{ }::=a|b|c|d|e[/tex]
[tex]<operand>\text{ }::=\text{ }NUMBER\text{ }|\text{ }<Identifier>[/tex]
[tex]<factor>\text{ }::=\text{ }<operand>|\text{ }-<operand>|\text{ }(<expression>)[/tex]
[tex]<power>\text{ }:=\text{ }<factor>\text{ }|\text{ }<factor>\text{**} <power>[/tex]
[tex]<term>\text{ }::=\text{ }<power>\text{ }\\|\text{ }<term>*<power>\text{ }\\|\text{ }<term>/<power>\\\\<expression>\text{ }::=\text{ }<term>\text{ }\\|\text{ }<expression>+<term>\text{ }\\|\text{ }<expression>-<term>[/tex]
BNF, or Backus-Naur Form, is a notation for expressing the syntax of languages. It is made up of a set of derivation rules. For each rule, the Left-Hand-Side specifies a nonterminal symbol, while the Right-Hand-side consists of a sequence of either terminal, or nonterminal symbols.
To define precedence in BNF, note that the rules have to be defined so that:
A negation or bracket matches first, as seen in the nonterminal rule for factorA power matches next, as seen in the rule defining a factorA multiplication, or division expression matches next, as seen in the rule defining a termFinally, addition, or subtraction match, as seen in the rule defining an expression.To make sure that the expression is properly grouped, or associativity is taken into account,
Since powers associate to the right (that is, [tex]x \text{**} y\text{**}z=x \text{**} (y\text{**}z)\text{ and not }(x \text{**} y)\text{**}z[/tex]), the rule defining power does this[tex]<power>\text{ }:=\text{ }<factor>\text{ }|\text{ }<factor>\text{**} <power>[/tex]
and not
[tex]<power>\text{ }:=\text{ }<factor>\text{ }|\text{ }<power>\text{**}<factor>[/tex]
Since multiplication/division are left associative (that is, [tex]x \text{*} y\text{*}z=(x \text{*} y)\text{*}z[/tex]), the rule defining a term takes this into account by specifying its recursion on the right of the operators like so;[tex]<term>\text{ }::=\text{ }<power>\text{ }\\|\text{ }<term>*<power>\text{ }\\|\text{ }<term>/<power>[/tex]
Also, addition and subtraction are left associative (that is, [tex]x \text{+} y\text{+}z=(x \text{+} y)\text{+}z[/tex]), the rule defining an expression takes this into account as seen below[tex]<expression>\text{ }::=\text{ }<term>\text{ }\\|\text{ }<expression>+<term>\text{ }\\|\text{ }<expression>-<term>[/tex]
Learn more about BNF grammars here: https://brainly.com/question/13668912
You work in an office that uses Linux and Windows servers. The network uses the IP protocol. You are sitting at a Windows workstation. An application you are using is unable to connect to a Windows server named FileSrv2. Which of the following commands would work BEST to test network connectivity between your workstation and the server?
a. arp
b. dig
c. tracert
d. nslookup
e. ping
Answer:
ping
Explanation:
its ping. im a computer science nerd :')
In which wireless configuration type do nodes communicate directly with each other, rather than with an access point?
1)802.11b
2)Mesh network
3)Ad-hoc
4)2.4Ghz
Ad-hoc
Explanation:
In which wireless configuration type do nodes communicate directly with each other, rather than with an access point? In an AD-HOC network, all nodes communicate and transmit directly to each other.
Identify the false statement. a. When you use inheritance to create a class, you save time because you can copy and paste fields, properties, and methods that have already been created for the original class. b. When you use inheritance to create a class, you reduce the chance of errors because the original class's properties and methods have already been used and tested. c. When you use inheritance to create a class, you make it easier for anyone who has used the original class to understand the new class because such users can concentrate on the new features.
Uploading this answer for points please do not accept this answer thank you.
Write SQL queries to answer the following questions: (15 points) a. Which students have an ID number that is less than 50000
Answer:
SELECT * FROM STUDENTS WHERE ID < 50000
Explanation:
If we assume the table is called STUDENTS, then we want to select everything (represented by *), where (like an if statement) the ID (assuming the name of the column) is less than 50000.
Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one word names (until -1), and use a recursive method to create and output all possible orderings of those names separated by a comma, one ordering per line.
The solution is the recursive Python 3 function below:
########################################################
def allNamePermutations(listOfNames):
# return all possible permutations of listOfNames
if len(listOfNames) == 0 or len(listOfNames) == 1:
# base case
return [listOfNames]
else:
# recursive step
result_list = [ ]
remaining_items = [ ]
for firstName in listOfNames:
remaining_items = [otherName for otherName in listOfNames if
(otherName != firstName)]
result_list += concat(firstName,
allNamePermutations(remaining_items))
return result_list
#######################################################
How does the above function work?
As with all recursive functions, this one also has a base case, and a recursive step. The base case tests to make sure the function terminates. Then, it directly returns a fixed value. It does not make a recursive call.
In the case of this function, the base case checked listOfNames to see if it was empty or only had one name. If any of the conditions were satisfied, a new list containing listOfNames is returned.
The recursive step is where the function allNamePermutations() calls itself recursively. The recursive step handles the case where listOfNames has more than one item. This step first iterates over each name in listOfNames, and then does the following;
Gets a name in listOfNameGets a list of other names in listOfNamesCalls allNamePermutations() on the list of other names to get a list of permutation of the other names.(By first getting the list of other names before passing it into
allNamePermutations(), we make sure the recursive step eventually
terminates. This is because we are passing a smaller list each time
we make the recursive call.)
Inserts the current name in front of each permutationAdds the results to the result list to be returned laterAfter the iteration, it returns the result list which will now contain all permutations of the names in the list.
The concat function is defined below
##################################################
def concat(name, listOfNameLists):
# insert name in front of every list in listOfNameLists
result_list = [ ]
for nameList in listOfNameLists:
nameList.insert(0, name)
result_list.append(nameList)
return result_list
#####################################################
If we run the sample test case below
####################################
name_list = ['Adam', 'Barbara', 'Celine']
allNamePermutations(name_list)
####################################
the following output is produced
[['Adam', 'Barbara', 'Celine'],
['Adam', 'Celine', 'Barbara'],
['Barbara', 'Adam', 'Celine'],
['Barbara', 'Celine', 'Adam'],
['Celine', 'Adam', 'Barbara'],
['Celine', 'Barbara', 'Adam']]
For another example of how to use recursion in Python, see the following example in the link below
https://brainly.com/question/17229221
Which of the following is a federal initiative that is designed to encourage organizations to address how critical operations will continue under a broad range of negative circumstances?
A continuity of operation planning (COOP) is an initiative that is designed by the federal government, so as to encourage business organizations and its departments to address how essential functions and critical operations will continue under a broad range of negative circumstances (disaster).
Business continuity can be defined as an advanced planning, processes, procedures, preparation, and decisions made by a business organization, so as to ensure the maintenance of essential functions and critical operations during and after the occurrence of a disaster. Thus, a disaster recovery plan (DRP), business impact analysis (BIA) and continuity of operation planning (COOP) are an integral and important part of business continuity.
A continuity of operation planning (COOP) is an initiative that is designed by the federal government of the United States of America, so as to encourage business organizations and its departments to address how essential functions and critical operations will continue under a broad range of negative circumstances (disaster).
In continuity of operation planning (COOP), an all round hazard approach is adopted rather than just focusing on specific hazardous events, in order to ensure essential functions and critical operations of a business organizations will continue under a broad range of negative circumstances (disaster).
Read more: https://brainly.com/question/17586013
What is the difference between (IF instructions & WHILE instructions )
0
를 들
T
!
Answer:
While statements determine whether a statement is true or false. If what’s stated is true, then the program runs the statement and returns to the first step. If what’s stated is false, the program exits the while and goes to the next statement. An added step to while statements is turning them into continuous loops. If you don’t change the value so that the condition is never false, the while statement becomes an infinite loop.
If statements are the simplest form of conditional statements, statements that allow us to check conditions and change behavior/output accordingly. The part of the statement following the if is called the condition. If the condition is true, the instruction in the statement runs. If the condition is not true, it does not. The if statements are also compound statements. They have a header (if x) followed by an indented statement (an instruction to be followed is x is true). There is no limit to the number of these indented statements, but there must be at least one.
Explain the role that the number of data exchanges plays in the analysis of selection sort and bubble sort. What role, if any, does the size of the data objects play
Answer:
The greater the number of exchanges are there greater is the complexity of the algorithm. Thus it is a measure to check for the complexity of the program.
list ten beeping sounds in a computer system according to the hard ware
Answer:
CMOS Shutdown Register Failure
Explanation:
Write a program that, given a file name typed by the user, reads the content of the file and determines the highest salary, lowest salary and average salary. The file contains employee records, and each record consists of the hours worked and the hourly rate. The salary is calculated as the product of the hours worked and the hourly rate.
An example of file containing three records is as follows:
10.5 25.0
40.0 30.0
30.9 26.5
Using the pandas packge in python, the program which performs the required calculation goes thus :
file_name = input()
#user types the filename
df = pd.read_csv(file_name, names=['hours_worked', 'rate']
#file is read into a pandas dataframe
df['salary'] = df['hours_worked'] * df['rate']
#salary column is created using the product of rate and hours worked
highest_salary = df['salary'].max()
#the max method returns the maximum value of a series
print('highest_salary)
lowest_salary = df['salary'].min()
#the min method returns the minimum value of a series
print('lowest_salary)
avg_salary = df['salary'].mean()
#the mean method returns the average value of a series
print('avg_salary)
Learn more : https://brainly.com/question/25677416
50 free po.intssssssss!
Answer:ty
Explanation:
What's computer hardware
How does a computer work?
Answer:
A computer is a Device that can run multiple applications at a time and access the internet where you can find online stores and more also used to make video calls and more.
Name a type of malware designed to provide unauthorized, remote access to a user's computer
Answer:
spyware
Explanation:
your welcome;)
Answer:
trojan horse
Explanation:
or just trojan
How has technology has impacted Ghana
Answer:
there are many ways that technology has impacted Ghana.
1. The republic of Ghana have been making some plans that can help with economic growth in the last decade.
2. Ghana has a higher productivity rate than the neighboring nations.
3. The republic of Ghana made a shift onto incentive-driven economic policies, so that way it could help improve leadership.