1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anna11 [10]
3 years ago
8

Write a program to complete the task given below: Ask the user to enter any 2 numbers in between 1-10 and add both of them to an

other variable call z. Use z for adding 30 into it and print the final result by using variable results.
Computers and Technology
1 answer:
joja [24]3 years ago
5 0

Answer:

a = int(input("Enter first value between 1 - 10"))

b = int(input("Enter second value between 1 - 10"))

z = a + b

z += 30

print("The value of z = ", z)

Explanation:

The code is written above in python language to perform the given task.

Now, let us explain each statement of code.

Step 1: The first two lines take input from the user prompting the user to enter the values between 1 to 10.

Then the values are type casted to int using int().

The values are stored in variables <em>a </em>and <em>b</em>.

Step 2: Then, the values of a and b are added to get another variable z.

Step 3: The statement 'z += 30' is equivalent to z = z+30

It adds 30 to the variable z and stores it in the same variable z.

Step 4: Finally the value of variable 'z' is printed using print() command.

You might be interested in
Write a function ngrams(n, tokens) that produces a list of all n-grams of the specified size from the input token list. Each n-g
ki77a [65]

Answer:

Explanation:

Assuming input is a string contains space separated words,

like x = "a b c d" we can use the following function

def ngrams(input, n):

input = input.split(' ')

output = []

for i in range(len(input)-n+1):

output.append(input[i:i+n])

return output

ngrams('a b c d', 2) # [['a', 'b'], ['b', 'c'], ['c', 'd']]

If you want those joined back into strings, you might call something like:

[' '.join(x) for x in ngrams('a b c d', 2)] # ['a b', 'b c', 'c d']

Lastly, that doesn't summarize things into totals, so if your input was 'a a a a', you need to count them up into a dict:

for g in (' '.join(x) for x in ngrams(input, 2)):

grams.setdefault(g, 0)

grams[g] += 1

Putting all together

def ngrams(input, n):

input = input.split(' ')

output = {}

for i in range(len(input)-n+1):

g = ' '.join(input[i:i+n])

output.setdefault(g, 0)

output[g] += 1

return output

ngrams('a a a a', 2) # {'a a': 3}

6 0
4 years ago
What versions of Wi-Fi Protected Access (WPA) were defined after the IEEE ratified the IEEE 802.11i security standard
aliya0001 [1]

Answer:

John is good in math rewrite it and punctuate

8 0
3 years ago
Ruth-Anne has created a document. She wants page 3 and all the pages after it to be formatted with two columns.
sertanlavr [38]

The correct answer is D. Go to page 3, click Page Layout, click Columns, click two.

Explanation

When you want to make a digital document, one of the most recommended tools for its quality and ease is Microsoft Word. In this program, you can edit documents as you wish, change the font, the font size, the distance of the margins, among other options. One of the options offered by this program is to add two or more columns of text, to carry out this action it is necessary to go to the page where you want to put two or more columns (in the case of Ruth-Anne, page 3), then click Page Design, there a menu is displayed in which the Columns option is found, click this option and there it will give us the option to choose the number of columns that we want to put (in the case of Ruth-Anne two columns), this will make this and subsequent pages have this setting in two or more columns of text. Therefore, if Ruth-Anne needs to make these edits to her document, she must follow these steps. So the correct answer is D. Go to page 3, click Page Layout, click Columns, click two.

4 0
3 years ago
How does the speaker feel about traditional forms of poetry
Salsk061 [2.6K]
A speaker sometimes is not able to capture the intended details since it is affected by homophones.
7 0
4 years ago
Read 2 more answers
Talia was a scientist whose research compared the birth rates of young women of a New England community over the course of five
podryga [215]

Answer: b

Explanation: for me personally i will populate an infographic(chart)rather than essay form i prefer to use an infographic to show my anaylis how it went high or low or when.

8 0
3 years ago
Read 2 more answers
Other questions:
  • When an instance of a class, or object, is specified as a parameter to a method, a reference to the said object is passed to the
    15·1 answer
  • What is cyber stalking and how does it work?
    7·2 answers
  • Given that two int variables, total and amount, have been declared, write a sequence of statements that: initializes total to 0
    14·1 answer
  • What type of cable is used to connect a workstation serial port to a cisco router console port?
    15·1 answer
  • A client has an issue with large files taking a long time to open or save. As time goes by, the issue worsens. The client has hu
    8·1 answer
  • A(n) ___________________ process is initiated by individuals who are subjected to forensic techniques with the intention of hidi
    6·1 answer
  • Which is a requirement for searching for a template
    14·1 answer
  • What are types of computer viruses
    11·2 answers
  • Which visual aid would be best for showing changes inacts population size over time?
    15·1 answer
  • Get ready to be the Quizmaster! You are going to design your own Python game show in the style of a quiz.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!