Answer:
The memory with variable names str1, str2, and str3 all have equal and the same value after the first if-statement.
Explanation:
The str1 was first assigned a null value while the str2 and str3 were assigned the string value "Karen" with the String class and directly respectively. On the first if-statement, the condition checks if the str1 is null and assigns the value of the variable str2 to str1, then the other conditional statement compares the values of all the string variables.
Write a program that keeps track of a simple inventory for a store. While there are still items left in the inventory, ask the user how many items they would like to buy. Then print out how many are left in inventory after the purchase. You should use a while loop for this problem. A sample run is below.
(CodeHS, PYTHON)
Answer:
STARTING_ITEMS_IN_INVENTORY = 20
num_items = STARTING_ITEMS_IN_INVENTORY
# Enter your code here
while num_items > 0:
print("We have " + str(num_items) + " items in inventory")
toBuy = int(input("How many would you like to buy?"))
if toBuy > num_items:
print("There is not enough in inventory")
print("Now we have " + str(num_items) + " left")
else: # ok to sell
num_items = num_items - toBuy # update
if num_items > 0: # only for printing
print("Now we have " + str(num_items) + " left")
print("All out!")
Explanation:
This allows Python to store the number of items in inventory after each purchase by subtracting how much is bought with the toBuy function by how much is left. This continues until num_items is no longer greater than zero. If what’s toBuy goes above the # of items left in inventory, then the “if toBuy > num_items” segment of the code comes into play by telling the user there’s not enough and re telling them how much is left and how much they’d like to buy. When the items in inventory is out, meaning the exact amount that’s left is purchased, then Python prints “All out!”
Following are the code to the given question:
Program Explanation:
Defining a variable "INVENTORY_ITEMS" that hold an integer value.Defining a variable "num" that holds "INVENTORY_ITEMS" value.In the next step, a while loop is declared that checks "num" value greater than 0.Inside the loop, "num and To_Buy" is declared and in the To_Buy it inputs value by user-end.In the next step, conditional statement is used that check "To_Buy" value and prints its value.At the last another conditional statement is used that checks num value, and print its value.Program:
INVENTORY_ITEMS = 20#defining a variable INVENTORY_ITEMS that hold integer value
num= INVENTORY_ITEMS#defining a num variable that holds INVENTORY_ITEMS value
while num > 0:#defining a while loop that check num value greater than 0
print("We have " + str(num) + " items in inventory")#print num value with message
To_Buy = int(input("How many would you like to buy?"))#defining To_Buy variable that inputs value
if To_Buy > num:#defining if block that check To_Buy value greater than num value
print("There is not enough in inventory")#print message
print("Now we have " + str(num) + " left")#print num value with message
else: # defining else block
num= num - To_Buy#using num variable that decreases num by To_Buy
if num> 0: #use if to check num greater than 0
print("Now we have " + str(num) + " left")#print num value with message
print("All out!")#print message
Output:
Please find the attached file.
Learn more:
brainly.com/question/18634688
What is the value stored at x, given the statements:
int x;
x=3/(int)(4.5+6.4)
a. 0.3
b. 0
c. .275229
d. 3.3
e. None of these
Answer:
0.
Explanation:
Given
int x;
x=3/(int)(4.5+6.4)
Required
What is x?
The first line of the code segment declares x as integer. This means that, it will only hold non decimal numbers.
With the above explanation, options (a), (c) and (d) can not be true.
Solving further:
x=3/(int)(4.5+6.4)
The computer evaluates the denominator as:
x=3/(int)(10.9)
The denominator is then converted to an integer. So, we have:
x = 3/10;
3/10 = 0.3 but
Recall that: x will only hold non decimal numbers.
So:
x = 0;
I really need help with this question I will give you five stars
Answer:
A
Explanation:
Edhesive 4.3 code practice question 1
Answer:
hugs = int(input("How old are you?: "))
hug = 0
while(hug < hugs):
print("**HUG**")
hug = hug + 1
Explanation: Enjoy
Answer:
age = int(input("Enter your age: "))
c = age
o = 0
while (o < age):
print("**HUG**")
o = o + 1
print("**virtual hug**")
Explanation:
what are the different alignment options available in Microsoft
Answer:
Step 1 − Click anywhere on the paragraph you want to align and click the Align Text Left button available on the Home tab or simply press the Ctrl + L keys.
Left Alignment
Center Aligned Text
A paragraph's text will be said center aligned if it is in the center of the left and right margins. Here is a simple procedure to make a paragraph text center aligned.
Step 1 − Click anywhere on the paragraph you want to align and click the Center button available on the Home tab or simply press the Ctrl + E keys.
Center Alignment
Right-Aligned Text
A paragraph's text is right-aligned when it is aligned evenly along the right margin. Here is a simple procedure to make a paragraph text right-aligned.
Step 1 − Click anywhere on the paragraph you want to align and click the Align Text Right button available on the Home tab or simply press the Ctrl + R keys.
Right Alignment
Justified Text
A paragraph's text is justified when it is aligned evenly along both the left and the right margins. Following is a simple procedure to make a paragraph text justified.
Step 1 − Click anywhere on the paragraph you want to align and click the Justify button available on the Home tab or simply press the Ctrl + J keys.
Justify Alignment
When you click the Justify button, it displays four options, justify, justify low, justify high and justify medium. You need to select only the justify option. The difference between these options is that low justify creates little space between two words, medium creates a more space than low justify and high creates maximum space between two words to justify the text.
Answer:
There are four main alignments: left, right, center, and justified. i think i answered this correct but easier to understand
Which of the following is the primary difference between analog and digital communication?
Im marking Brainliest
electric cables vs. fiber cables
electric pulses vs. electronic devices
radio signal vs. microwave signal
radio signal vs. radio frequency
Answer:
Radio signal vs. microwave signal.
Explanation:
it's the suitable but again it's a weak answer to compare analog from digital signals
Answer:
Electric pulses vs. electronic devices
Explanation:
edg2021
direct quote from AV notes: "Analog technology transmits information using electric pulses. The human voice is the best example of analog communication. As the telephone was the major communication channel in the past, analog communication was common and the only type used.
Today, we depend on digital communication. Digital technology breaks down information into numerical bits and transmits the bits to digital receivers that decode the bits and recompose the original information. "
Cell address $A$4 in a formula means it is a ___________. *
A. All of the above
B. Mixed cell reference
C. Relative cell reference
D.Absolute cell reference
Answer:
The answer to this question is given below in the explanation section
Explanation:
Cell address $A$4 in a formula means it is an Absolute Cell Reference.
Absolute cell reference does not change when you copy the formula to other cells. when the $ symbol added in the front of the column and row, makes it absolute. It stops the row and column numbers from changing when you copy to other cells. The given $A$4 cell address contains the value in column A and row 4. It does not change the value when you copy the formula that has mentioned ($A$4) into other cells. For example, if you have value 10 at row 4 and column A. Then you multiple column B with A4 cell value and you want that A4 value will not change while copying formula from C1 to C10. You can use in column C1 as =B1*$A$4. Then you copy the formula to cell 10. The value of $A$4 will not change.
while the other options are not correct because:
In the relative cell reference values get changed in the formula, while in the mixed cell reference you can either locked the row or column while the row or column changes when the formula is copied respectively.
The ________ function deletes all elements of the list.
Answer:
clear
clear() :- This function is used to erase all the elements of list.
Explanation:
The clear function deletes all elements of the list. The clear method removes all the elements from a list.
What is a function?Simply said, a function is a “chunk” of code that you may reuse repeatedly rather than having to write it out several times. Programmers can divide an issue into smaller, more manageable parts, each of which can carry out a specific task, using functions.
A list's whole contents are cleared via the clear() method. It returns an empty list after removing everything from the list. No parameters are required, and if the list is empty, no exception is raised. The clear function is present in all languages of computers but has different codes and functions.
Therefore, the list's whole contents are removed by the clear function. All of the elements in a list are removed by the clear method.
To learn more about the function, refer to the link:
https://brainly.com/question/17001323
#SPJ2
Is there anyone who is very good with Microsoft access?
Answer:
na i can boot people offline
Explanation:
Let G = (V, E) be an undirected graph. Design algorithms for the following (in each
case discuss the complexity of your algorithm):
(a) Assume G contains only one cycle. Direct the edges s.t. for each u, indegree(u) [tex]\leq[/tex] 1.
(b) Determine whether it is possible to direct the edges of G s.t. for each u, indegree(u) [tex]\geq[/tex] 1.
If it is possible, your algorithm should provide a way to do so.
(c) Let S be a subset of edges s.t. every cycle of G has at least one edge in S. Find a
minimum size subset S.
Answer:
i think its b if not sorry
Explanation:
I need help with coding in python!
class CommandLine:
def __init__(self):
self.root = Directory('', None)
self.current_path = self.root
def run(self):
command = input('>>> ')
while command.strip().lower() != 'exit':
split_command = command.split()
if len(split_command):
if split_command[0] == 'ls':
self.current_path.display()
if len(split_command) >= 2:
if split_command[0] == 'cd':
self.change_directory(split_command[1])
elif split_command[0] == 'makedir':
self.current_path.create_directory(split_command[1])
elif split_command[0] == 'fcreate':
self.current_path.create_file(split_command[1])
elif split_command[0] == 'fwrite':
self.current_path.file_write(split_command[1])
elif split_command[0] == 'fread':
self.current_path.file_read(split_command[1])
elif split_command[0] == 'fclose':
self.current_path.close_file(split_command[1])
elif split_command[0] == 'fopen':
self.current_path.open_file(split_command[1])
command = input('>>> ')
def change_directory(self, dir_name):
pass
class Directory:
def __init__(self, name, parent):
pass
def display(self):
pass
def create_file(self, file_name):
pass
def create_directory(self, dir_name):
pass
def file_write(self, file_name):
pass
def file_read(self, file_name):
pass
def close_file(self, file_name):
pass
def open_file(self, file_name):
pass
class File:
pass
if __name__ == '__main__':
cmd_line = CommandLine()
cmd_line.run()
You must keep track of your current directory, and then you must be able to execute the commands listed below.
(The commands are explicitly different from linux so that you don't accidentally execute them in the shell, except for ls and cd which are harmless.)
Command
ls
Lists contents of the directory
cd [dirname]
Change directory up or down one level.
makedir [dirname]
Make a directory
fcreate [filename]
Creates a file, sets it closed.
fwrite [filename]
Write to a file, only if it's open.
fread [filename]
Read a file, even if it's closed.
fclose [filename]
Close a file. Prevents write.
fopen [filename]
Open a file. Reset the contents
Answer:
B
Explanation:
1, and
Which line of code could be used for a constructor?
e
O definit (firstName, lastName, id Num):
O definit(self, firstName,lastName,idNum):
O def
_init_(firstName, lastName idNum):
O def
_init__(self, firstName,lastName idNum)
Answer:
i think (first name last name id Num)
ANSWER ASAP! Which statements are true? Select 4 options.
A function can have many parameters.
A function can have a numeric parameter.
A function can have only one parameter.
A function can have a string parameter.
A function can have no parameters.
Please answer asap. Thank you.
Answer:
A,B,D and E are true
Explanation:
In many if not all programming languages, a function can have zero or more parameters of arbitrary type.
i have no idea how to get this answer, but here.
edge 2021
do you agree or disagree with the assertion that edutech transforms teachung and learning
Answer:I agree!
Explanation:
Agree
You are suddenly given a very large (1000 ) number of old desktop computers with old CRT monitors. What could you do with them
Answer:
I would fix them if they were broken, make good use of them and give them out to other people as marketing or sell them.
Explanation:
Ship, CruiseShip, and CargoShip ClassesDesign a Ship class that has the following members:a. a member variable for the name of the ship (a string)b. a member variable for the year that the ship was built (a string)c. A constructor and appropriate accessors and mutatorsd. A virtual print function that displays the ship's name and the year it was built.
Answer:
def shipvari(ship);
Cruiseship="" #defining a string
YearBuilt= ""
for i in range(ship);
if Cruiseship="";
print(CruiseShip)
Give the rest a try!
The following statement calls a function named half, which returns a value that is half
that of the argument. (Assume the number variable references a float value.) Write
code for the function.
result = half(number)
Answer:
function half(number) {
let result = number/2;
return result;
}
Explanation:
Write a C Program to Print the initial letter of Name Ferdous
Answer:
The answer to this question is given below in the explanation section.
Explanation:
The question is about writing a C program that prints the initial letter of Name Ferdous.
Therefore, below is the given complete code that prints the first letter of the name Ferdous.
#include <stdio.h> /*import strandard input/output library*/
#include<string.h> /*import string library to handle string type of data*/
int main(void) /*started the program execution- program entry point*/
{
char *str = "Firdous"; /*char to pointer str contains string "Firdous"*/
int len = strlen(str); /*this line of code is not neccary, but if you print other character for example last character of the name then you can use it*/
printf("First Letter of the name is: %c", str[0]); /*print first letter of the name*/
} /**program terminated*/
Given positive integer num_insects, write a while loop that prints that number doubled up to, but without exceeding 100. Follow each number with a space.
Sample output with input: 8
8 16 32 64
Here's what I havenum_insects = 8 # Must be >= 1print(num_insects, '', end='')while num_insects <= 100 : num_insects = num_insects * 2 print(num_insects,'', end="")This code prints the number 128 even thought the loop is set to end after 100? Why is that?
Answer:
The while loop is executed one more time when num_insects is 64. It gets doubled and 128 gets printed. Then the while loop is not executed anymore since 128 exceeds 100.
So the reason you see 128 is because the multiplication by 2 happens inside the loop before you print. You enter it with 64, but by the time you get to the print statement, it was already multiplied.
The solution is to switch the print and the multiply:
num_insects = 8 # Must be >= 1
while num_insects <= 100 :
print(num_insects,'', end="")
num_insects = num_insects * 2
This has one added advantage that the very first print statement outside the loop can be removed.
What is the last usable host IP address on the 192.168.32.9/30 network?
Answer:
192.168.32.10
Explanation:
HOPE THIS HELPS:)
Which interpersonal skill is the most important for a telecom technician to develop?
active listening
teamwork
conflict resolution
social awareness
Answer:
active listening is interpersonal
Answer:
active listening
Explanation:
edg2021
telecom technicians go to homes and officies to listen to the consumers demands to fix their internet and other telecommmunication issues. They mostly work alone and simply need to be aware of the issue and what they are doing to fix it.
Write a program that reads a string from the user containing a date in the form mm/dd/yyyy. If the user entered 12/10/2019, then it should print the date in the form December 10, 2019. solution in python.
Answer:
months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
date = input("mm/dd/yyyy: ")
splitdate = date.split("/")
print(months[int(splitdate[0])-1]+" "+splitdate[1]+", "+splitdate[2]+".")
Explanation:
This line initializes a list of all 12 months
months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
This prompts the user for date
date = input("mm/dd/yyyy: ")
This splits the date into three parts; mm with index 0, dd with index 1 and yy with index 2
splitdate = date.split("/")
The following prints the required output
print(months[int(splitdate[0])-1]+" "+splitdate[1]+", "+splitdate[2]+".")
Analyzing the print statment
splitdate[1] represents the day of the date
splitdate[2] represente the month of the date
However, in months[int(splitdate[0])-1]
First: splitdate[0] represents the month of the year as a string in numeric form e.g. "12", "01"
It is first converted to an integer as: int(splitdate[0])
Then the corresponding month is derived from the month list
match the databse function to it's purpose
Answer:
Explanation:
Which database functions?
Use the {blank} to view your presentation the way an audience will see it.
A. Slide Show Button
B. Play Button
C. Tools Menu
D. View Menu
Answer:
A. Slide Show Button
Explanation:
A certain instructor assigns a 50-point problem and calculates an integer score 0-50 and assigns a letter grade according to the scale 40 - 50 is an A, 30 - 39 is a B, 20 - 29 is a C, 10 - 19 is a D and 0 - 9 is an F. Write a Python function called letter_grade which takes one argument, an integer, and RETURNS the appropriate letter grade.
Answer:
Following are the code to this question:
def letter_grade(x): #defining a method letter_grade that accepts one parameter
if x>=50 and x<=40:#defining if block that check value of x greater than 50 and less than 40
print("A")#print value
if x>=30 and x<=39:#defining if block that check value of x greater than 30 and less than 39
print("B")#print value
if x>=20 and x<=29:#defining if block that check value of x greater than 20 and less than 29
print("C")#print value
if x>=10 and x<=19:#defining if block that check value of x greater than 10 and less than 19
print("D")#print value
if x>=0 and x<=9:#defining if block that check value of x greater than 0 and less than 9
print("F")#print value
letter_grade(30) #calling the method letter_grade
Output:
B
Explanation:
In the above Python code, a method "letter_grade" is declared, that accepts an integer variable in its parameter, and defined the multiple if block to check the given value, which can be defined as follows:
In the first, if block, it checks the value of x greater than 50 and less than 40 , if the condition is true it will print the value "A".In the second, if block, it checks the value of x greater than 30 and less than 39, if the condition is true it will print the value "B".In the third, if block, it checks the value of x greater than 20 and less than 29, if the condition is true it will print the value "C". In the fourth, if block, it checks the value of x greater than 10 and less than 19, if the condition is true it will print the value "D".In the fifth, if block, it checks the value of x greater than 0 and less than 9, if the condition is true it will print the value "F".And at the last it call the method.
Sam’s password is known to be formed of 3 decimal digits (0-9) in a given order. Karren and Larry are attempting to determine Sam’s password by testing all possible combinations. If they are only able to try 10 combinations every day, how many days would it take to try all the possible combinations? 1000 100 3 73
Answer:
100
Explanation:
Answer:
The answer is 100, hope this helps!
Explanation:
Divide a network 10.10.0.0 with subnet mask 255.255.0.0 into 62 subnets.
10.10.0.0
0000 1010. 0000 1010 . 0000 0000 . 0000 0000
255.255.0.0
1111 1111. 1111 1111 . 0000 0000 . 0000 0000
Required:
a. How many bits do we need to borrow from the host portion?
b. List the lowest and the highest IP address of the first usable subnet.
c. How many usable hosts are there in total before and after subnetting?
Answer:
A. 6 bits
B. lowest IP address is 10.10.0.1 and the highest IP address is 10.10.3.254
C. total number of usable hosts before subnetting = 65534
total number of usable hosts after subnetting = 65408
Explanation:
The IP address 10.10.0.0 with the subnet mask 255.255.0.0 is a class B address with 16 bits of the network address portion and 16 bits of the host portion.
To subnet the address to use 62 subnets (and to reduce the host IP address wasted) 6 bits are borrowed from the host portion of the address to give 2^6 = 64 subnets with two usable host addresses.
The first network address is 10.10.0.0 and the first usable host address of the subnet is 10.10.0.1 making it the lowest address, while the broadcast address is 10.10.3.255 and the address before it becomes the higher address in the network which is 10.10.3.254
The number of usable host of the network before subnetting is 2^16 -2 = 65534, while after subnetting is (2^(16-6) - 2) x 64 = 65408.
Given an array of users, write a function, namesAndRoles that returns all of user's names and roles in a string with each value labeled.For example: const users = [ { name: 'Homer', role: 'Clerk', dob: '12/02/1988', admin: false },{ name: 'Lisa', role: 'Staff', dob: '01/30/1965', admin: false },{ name: 'Marge', role: 'Associate', dob: '09/10/1980', admin: true } ] namesAndRoles(users) // Name: Homer // Role: Clerk // Name: Lisa // Role: Staff // Name: Marge // Role: Associatefunction namesAndRoles(users) { return users } namesAndRoles(users)
Answer:
def namesAndRoles(users):
for user in users:
return f"{user[name]}, {user[role]}"
Explanation:
The python program gets the list of dictionaries of the users in a company and returns the user names and their roles. The code is defined as a function and is executed when the function is called.
Can race condition happen in monolithic memcached.
a. True
b. False
Answer:
True
Explanation:
It is TRUE that race condition happens in monolithic Memcached. This is evident in that in a python language, where Memcached "gets" and "set" function tends to turn to a race condition if for example the two functions are used together to accomplish similar things like locking given that it is not atomic.
Hence, in this case, the correct answer is TRUE
It should be noted that a race condition cannot occur in monolithic memcached. Therefore, it's false.
A race condition simply means when two threads are able to access a shared variable at a particular time.
In such a case, the first thread and the second thread will perform their operations on the value and they'll race in order to see the thread that can write the value last row of the variable that's shared. A race condition
cannot occur in monolithic memcached. Therefore, it's false.
Learn more about race condition on:
https://brainly.com/question/13445523
I've got the answer, I just need someone to explain it, please!