def is_even_number(n):
return True if n % 2 == 0 else False
while True:
number = int(input("Enter a number: "))
if number == 0:
break
else:
if is_even_number(number):
print("Even")
else:
print("Odd")
I wrote my code in python 3.8. I hope this helps.
How to format each dictionary item as a text string in the input file. How to covert each input string into a dictionary item. How to format each item of your inverted dictionary as a text string in the output file.
Answer:
- To get the items of a dictionary and print them as a string, use the items() method to unpack the keys and values in a for and print or write them into a file.
for key, value in mydict.items():
print(f"{key}, {value}")
- To convert string from user input into dictionary;
mystring = input().split(" ") #assuming the words are separated by a space.
from word in mystring:
mydict[word] = mydict.get(word, 0) + 1
This would use the words in the string as the keys of the dictionary and the count of each word as the respective values.
Explanation:
A dictionary is a data structure in python used to store data in key-value pairs. The items are enclosed in curly braces and can be accessed with the key in dot or bracket notation.
Dictionaries in Python are used to represent data items in pairs; i.e. key and values
(a) Format items as strings in an input file
To do this we make use of the file manipulation.
Assume the dictionary name is given as: myDict
See attachment for the complete solution
Read more about Python dictionary at:
https://brainly.com/question/14353514
Fix the infinite loop so that it counts from 3 down to 1.public class Loop1{public static void main(String[] args){int x = 3;while (x > 0){System.out.println(x);}}}
Answer:
Include x-- right after the print statement
Explanation:
Given:
The above lines of code
Required
Edit to countdown from 3 to 1
The above code (as it is) prints 3 in infinite times. To make it countdown to 1, we simply include a decrement operation.
Initially, the value of x is 3: int x = 3;
And the condition is that the loop is to be repeated as long as x > 0
All we need to do is to include x-- right after the print statement.
This operation will reduce the value of x on every iteration as long as the condition is true.
Hence, the complete code is:
public class Loop1{
public static void main(String[] args){
int x = 3;
while (x > 0){
System.out.println(x);
x--;
}}}
Write a list comprehension statement to generate a list of all pairs of odd posi
Answer:
Print([(a,b) for a in range(10) for b in range(10) if (a < b and a%2 == 1 and b%2 == 1)])
Explanation:
Here, we declared a range of value for a and b using a for loop and the range function. The values are the first 10 numeric digits. The we used the if statement to establish our constraints;
In other to ensure that ;
Lower digit is written first ; (a < b) ;
Only odd numbers are considered,
a%2 == 1 ; b%2 == 1 (remainder when a and b are divided by 2 is 1.
Both a and b are declared as a tuple in other to obtain a pair of odd values.
Recently, Walmart offered a wireless data contract based on bandwidth used, with a minimum monthly charge of $42 for up to 5 gigabytes (GB) of use. Additional GB can be purchased at the following rates: $12 for an additional 1 GB, $28 for an additional 3 GB, and $44 for a capacity of 10 GB. What is the cost for a user who is expecting to use 9 GB
Answer:
For 9GB of data the user would pay $82 monthly!
Explanation:
To start off, our end goal is 9GB. We have the equation 9 = ? We can add up to our solutions with 1GB, 3GB, and 10GB. We can immediately rule out 10GB, since 9GB ≠ 10GB. To cost the least amount of money we can add up 3GB and 1GB = 4GB + 5GB = 9GB!
So, our equation is 3GB + 1GB + 5GB = 9GB, now lets figure out the cost!
$28 + $12 + $42 = $82
For 9GB of data the user would pay $82 monthly!
Hope this Helps! :)
Have any questions? Ask below in the comments and I will try my best to answer.
-SGO
Which of the following methods can be used to solve the knapsack problem?
a. Brute Force algorithm
b. Recursion
c. Dynamic programming
d. All of the mentioned
Answer: D. All of those mentioned
Explanation:
The knapsack problem is a problem that typically occurs in combinatorial optimization and is also a 2D dynamic programming example.
We should note that all the methods given in the option such as recursion, brute force algorithm and dynamic programming can all be used to solve knapsack problem.
Therefore, the correct answer is D.
please help
Write a method that takes 5 ints as parameters and returns the average value of the 5 ints as a double.
This method must be named average() and it must have 5 int parameters. This method must return a double.
Calling average(1, 5, 7, 4, 10) would return 5.4.
Answer:
Answered below
Explanation:
This solution is written in Kotlin programming language.
fun average (a: Int, b: Int, c: Int, d: Int, e: Int) : Double {
#variable to hold the addition of all parameters
var sum = a + b + c + d + e
#variable to hold the average of sum
var avg = sum / 5
return avg
}
#call the function to see how it works.
# this operation is done in the fun main()
var test: Double = average ( 5, 4, 7 , 3, 9)
print (test)
How many minutes are there from 8:00 am to 1:00 pm?
Answer:300 minutes
Explanation:
from 8 to 1 is 5 hours so you do 5*60= 300
A counter is ?
A. used only outside of the loop
B. none of the above
C. a variable used in a loop to count the number of times an action is performed
D. A person with a pen and paper
Which 2 problems does the Pay down credit card workflow solve for clients? (Select all that apply) It helps clients stay on top of making payments on time It ensures that payments to credit card accounts are categorized correctly It provides a lower rate than most credit cards to qualified small businesses It uses language that non-accountants can understand
Answer:
B. It ensures that payments to credit card accounts are categorized correctly
D. It uses language that non-accountants can understand
Explanation:
Pay down credit card workflow is a new feature that makes entering records in QuickBooks easier for users. The two prime benefits of this workflow are;
1. It ensures that payments to credit card accounts are well categorized well. Without this feature, users most times find it difficult to enter records correctly or they tend to duplicate entries. This new feature obtains vital information that helps the software to correctly credit the accounts.
2. It uses language that non-accountants can understand. This simplifies the process and makes it easier for the user to enter the right data that would help the software to correctly credit the accounts.
discuss how sentiment analysis works using big data?
sentiment analysis is the process of using text analytics to mine various of data for opinions. often sentiment analysis is done on the data that is collected from the internet & from various social media platforms.
What will the output of the statements below? System.out.println(9%2); System.out.println(12%6); The output of the first statement is * The output of the second statement is
Answer:
You get Exact 30 print of that sentence on a comadore 64
Explanation:
Just simple basic science. hope this helps
what security issues could result if a computer virus or malware modifies your host file in order to map a hostname to another IP address
Answer:
Man-in-the-middle attack
Explanation:
In this type of attack, the hacker uses the virus or malware to get and change his IP address and hostname to match the address and hostname of the target host computer. The allows the hacker to gain access to information sent to the target IP address first.
What is the output of the following program
#include
int toronto (int x)
{
int w;
if (x == 0) w = 1; else w = toronto (x-1);
return (w);
}
int main (void)
{
int a = 2;
printf ("%d", toronto (a));
return (0); }
a. 0
b. 1
c. 2
d. -1
e. none of these
Answer:
The output is 1
Explanation:
Analysing the flow of program (We start from the main method)
The main begins here
int main (void) {
This line declares a as integer and also initializes it to 2
int a = 2;
This line passes 2 to the function names toronto and also prints the result of the function
printf ("%d", toronto (a));
return (0); }
The toronto function begins here.
Note that the function receives 2 as its argument and this is saved in variable x
int toronto (int x) {
This declares w as integer
int w;
If x is 0, w equals 1
if (x == 0) w = 1;
If otherwise
else
This reduces x by 1 and performs a recursion
w = toronto (x-1);
return (w);
}
Because of the structure of the if condition in the toronto function, the function will be repeated until x is 0.
And when x = 0; w = 1
This returns w (i.e. 1) back to the main function where 1 is printed as the output
return (w);
what type of device is a projector ?
a. input
b. memory
c. output
d. storage
Answer:
output
Explanation:
if I'm wrong sorryyy
Answer:
Output
Explanation:
:D
Which of the following statements is true when it comes to developing a web presence for a business?
Explanation:
Customers can learn about a business by downloading a mobile app, but they can’t place an order using an app
Building a new website requires a large budget
Question 57 Which type of application attack would include User denies performing an operation, attacker exploits an application without trace, and attacker covers her tracks
Answer:
Auditing and logging
Explanation:
Auditing and logging is a form of application threats and attacks that an application security is susceptible to. It involves a user denies performing an operation; attacker exploits an application without trace, and at the same time attacker covers his or her tracks.
To prevent this, an Auditing and logging countermeasure should be put in place of application security to guide against such aforelisted threats and attacks before its actual occurrence.
Therefore, in this case, the correct answer is "Auditing and logging."
java Elements in a range Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain fewer than 20 integers. That list is followed by two more integers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). For coding simplicity, follow each output integer by a comma, even the last one. The output ends with a newline. Ex: If the input is: 5 25 51 0 200 33 0 50 then the output is: 25,0,33, (the bounds are 0-50, so 51 and 200 are out of range and thus not output). To achieve the above, first read the list of integers into an array.
Answer:
The program in Java is:
import java.util.Scanner;
public class MyClass {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int n;
n = input.nextInt();
int [] mylist = new int[n+1];
mylist[0] = n;
System.out.print("List elements: ");
for(int i = 1;i<n+1;i++){
mylist[i] = input.nextInt();
}
int min,max;
System.out.print("Min & Max: ");
min = input.nextInt();
max = input.nextInt();
for(int i=1; i < mylist.length; i++){
if(mylist[i]>=min && mylist[i]<=max){
System.out.print(mylist[i]+" ");
}
}
}
}
Explanation:
This line declares length of list
int n;
This line gets length of list
n = input.nextInt();
This line declares the list/array
int [] mylist = new int[n+1];
This line initializes the element at index 0 to the length of the list
mylist[0] = n;
This prompts user for elements of the list/array
System.out.print("List elements: ");
The following iteration gets list elements
for(int i = 1;i<n+1;i++){
mylist[i] = input.nextInt();
}
This declares the lower and upper bound (min, max)
int min,max;
This line prompts user for elements of the list/array
System.out.print("Min & Max: ");
This next two lines get the bound of the list/array
min = input.nextInt();
max = input.nextInt();
The following iteration prints the elements in the range
for(int i=1; i < mylist.length; i++){
if(mylist[i]>=min && mylist[i]<=max){
System.out.print(mylist[i]+" ");
}
}
How many total beats are these tied notes worth, assuming a quarter note equals 1 beat?
A. One
B. Five
C. Three
Answer:
one i think
Explanation:
The _____ Tag surrounds all content that will be visible on your web page for all to users to see on that website.
Answer:
The body tag
Explanation:
HTML has several tags; however, the tag that handles the description in the question is the body tag.
It starts with the opening tag <body> and ends with closing tag </body>
i.e.
<body>
[Website content goes in here]
</body>
Any text, image, object etc. placed within this tag will be displayed in the website
She can't part.....her jewels.
Answer:
She can't part with her jewels.
Explanation:
:))))
Karin realized that a song takes up a lot more space on her computer than the lyrics of the song typed out in ms word document . Why does this happen
NEED HELP WILL MARK BRAINLIEST AND 25 POINTS FOR ANSWER Which statement best describes a characteristic of a relational database?
It contains tables that are completely independent of one another.
It contains tables with fields that are associated with one another.
It is a feature that is primarily used to navigate databases.
It is a feature that is primarily used to add queries to tables.
The relational database has the characteristic feature of the adjoining of data with one another.
What is a relational database?The relational database is given as the interconnection of the data with the digital database management system.
The relational database is given with the characteristics of the adjoining of data tables and fields associated with one another. Thus, option B is correct.
Learn more about relational database, here:
https://brainly.com/question/13262352
#SPJ2
Which are the steps in the process of creating a database
Answer:
Determine the purpose of your database. ...
Find and organize the information required. ...
Divide the information into tables. ...
Turn information items into columns. ...
Specify primary keys. ...
Set up the table relationships. ...
Refine your design. ...
Apply the normalization rules.
Answer:
identifying fieldnames in tables
defining data types for field names
Explanation:
sorry I'm late. future Plato users this is for you
please help me please help me.
Answer:
dont know man thanks for points tho
but it is 209
Explanation:
we need to send 254 kbps over a noiseless channel with a bandwidth of 15 khz. how many signal levels do we need
Answer:
The level of the signal is 353.85
Explanation:
Data rate determines the speed of the data transmission.
The data rate depends on the following factors
The available bandwidthnumbers of signal levelsthe quality of the channel ( Means the level of noise )The data is transmitted either from a noiseless channel or a noisy channel.
The given quality of the channel in the question is noiseless.
Use the following formula to calculate the signal levels
Bit rate = 2 x bandwidth x [tex]Log_{2}[/tex] ( signal level )
where
Transmitted Data = 254 kbps = 254,000 bps
Bandwidth = 15 khz = 15,000 hz
Placing values in the formula
254,000 = 2 x 15,000 x [tex]Log_{2}[/tex] ( L )
254,000 = 30,000 x [tex]Log_{2}[/tex] ( L )
254,000 / 30,000 = [tex]Log_{2}[/tex] ( L )
8.467 = [tex]Log_{2}[/tex] ( L )
L = [tex]2^{8.467}[/tex]
L = 353.85 levels
Choose the type of collection created with each assignment statement
____ collection A = {5:2}
Options: tuple, dictionary, list
____ collection B = (5,2)
Options: tuple, dictionary, list
____ collection C = [5,2]
Options: tuple, dictionary, list
Answer:
dictionary
tuple
list
Explanation:
. Else-if is good selection statement that help us to solve problems in C++,mostly times same problem of same nature can also be solved via switch statement. Which one you prefer to use and why?
Answer:
Else-If statements
Explanation:
Personally, I prefer using Else-If statements for conditional statements since you can start with and If statement and add to it if necessary. Aside from this, Else-If statements also allow you to add more than one condition to be met by using tags such as and or and not. Switch statements are better in scenarios where you have a set of possible inputs or results and need a specific event to happen for each input/result, but this is not as common of a scenario so Else-If is usually my go-to conditional statement.
Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outpu
Answer:
Explanation:
The following program is written in Java and is a function that asks the user for an input and keeps doing so until a negative value is entered, in which case it calculates the average and max values and prints it to the screen.
public static void average () {
int num;
int sum = 0;
Scanner in = new Scanner(System.in);
System.out.println("Enter Number");
num = in.nextInt();
int count = 0;
int max = 0;
while(num >= 0)
{
sum+=num;
System.out.println("Enter Number");
num = in.nextInt();
count++;
if(num>=max){
max = num;
}
}
System.out.println(sum/count);
System.out.println(max);
}
Answer:hi
Explanation:
please help me
Match the technology with the appropriate task.
1. graphics software
2. word processor
3. CAD
4. laptop
5. GPS
Complete Question:
Match the technology with the appropriate task.
Column A
1. Graphics software
2. Word processor
3. CAD
4. Laptop
5. GPS
Column B
A. Create a company logo.
B. Get directions to a customer’s office.
C. Type a report.
D. Complete many types of tasks on a computer away from the office.
E. Design a building.
Answer:
1. A
2. C
3. E
4. D
5. B
Explanation:
1. Graphics software: it can be used to create a company logo. Some examples of software applications or programs are Adobe photoshop, Core-draw, illustrator etc.
2. Word processor: it is typically used for typing a text-based document. For instance, type a report. Some examples are notepad, Microsoft Word, etc.
3. CAD: design a building. CAD is an acronym for computer aided design used for designing the graphical representation of a building plan. An example is Auto-CAD.
4. Laptop: complete many types of tasks on a computer away from the office. A laptop is compact and movable, so it can be easily used in any location.
5. GPS: directions to a customer’s office. GPS is an acronym for global positioning system and it is typically used for locating points and directions of a place.
Answer:
1. A
2. C
3. E
4. D
5. B
True or false: In relational databases, each individual space within a row or column contains exactly one value.
Answer:
True.
Explanation:
A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to create, store, modify, retrieve and manage data or informations in a database. Generally, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.
A data dictionary can be defined as a centralized collection of information on a specific data such as attributes, names, fields and definitions that are being used in a computer database system.
In a data dictionary, data elements are combined into records, which are meaningful combinations of data elements that are included in data flows or retained in data stores. This ultimately implies that, a data dictionary found in a computer database system typically contains the records about all the data elements (objects) such as data relationships with other elements, ownership, type, size, primary keys etc. This records are stored and communicated to other data when required or needed.
Basically, when a database management system (DBMS) receives data update requests from application programs, it simply instructs the operating system installed on a server to provide the requested data or informations.
A relational database can be defined as a type of database that is structured in a manner that there exists a relationship between its elements.
Hence, in relational databases, each individual space within a row or column contains exactly one value.