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
Anna007 [38]
2 years ago
10

Create a dictionary with types as integer and string.

Computers and Technology
1 answer:
Airida [17]2 years ago
7 0

Answer:

In c#  Dictionary is the collection of keys and value .The dictionary is a generic collection class which is in the System.Collection.Generics namespace. we can represent dictionary like that Dictionary<TKey, TValue> where TKey represent the type of key and TValue is the type of TValue.

Following are the example which represent dictionary as integer and string

using System.Collections.Generic;  // namespace

class Test // class test

{

   static void Main()  // main method

   {

       

       var ob = new Dictionary< int,string>();  // type integer and string

       dictionary.Add( 2,"hello");

       dictionary.Add(143,"hello1);

       // The dictionary has 2 pairs.

       Console.WriteLine("DICTIONARY 1 " + ob.Count);

}

}

Output:

DICTIONARY 1 :2

Explanation:

In this program we create a dictionary generic class which is integer and string type after that we add the elements in the dictionary by   "dictionary.Add method " and finally print the count of dictionary

You might be interested in
To make something ready for some activity is to ________it.
WINSTONCH [101]

Answer:

prepare (e.g. SQL prepared statements)

parse/convert (e.g. parse a string as an int/convert an array to string)

Explanation:

4 0
3 years ago
Write the code to produce a for loop that counts down from 20 to 0 by 2’s and prints the number each time it goes through the lo
yulyashka [42]

Explanation:

Count-controlled for loop (Three-expression for loop)

This is by far the most common type. This statement is the one used by C. The header of this kind of for loop consists of a three-parameter loop control expression. Generally it has the form:

for (A; Z; I)

A is the initialisation part, Z determines a termination expression and I is the counting expression, where the loop variable is incremented or dcremented. An example of this kind of loop is the for-loop of the programming language C:

for (i=0; i <= n; i++)

This kind of for loop is not implemented in Python!

Numeric Ranges

This kind of for loop is a simplification of the previous kind. It's a counting or enumerating loop. Starting with a start value and counting up to an end value, like for i = 1 to 100

Python doesn't use this either.

Vectorized for loops

They behave as if all iterations are executed in parallel. This means, for example, that all expressions on the right side of assignment statements get evaluated before the assignments.

Iterator-based for loop

Finally, we come to the one used by Python. This kind of a for loop iterates over an enumeration of a set of items. It is usually characterized by the use of an implicit or explicit iterator. In each iteration step a loop variable is set to a value in a sequence or other data collection. This kind of for loop is known in most Unix and Linux shells and it is the one which is implemented in Python.

Example of a simple for loop in Python:

>>> languages = ["C", "C++", "Perl", "Python"]  

>>> for x in languages:

...     print(x)

...  

C

C++

Perl

Python

>>>

3 0
3 years ago
Write an application that displays every perfect number from 1 through 1,000. A perfect number is one that equals the sum of all
matrenka [14]

Answer:

Written in Python

for num in range(1,1001):

    sum=0

    for j in range(1,num+1):

         if num%j==0:

              sum = sum + j

                   if num == sum:

                        print(str(num)+" is a perfect number")

Explanation:

This line gets the range from 1 to 1000

for num in range(1,1001):

This line initializes sum to 0 for each number 1 to 1000

    sum=0

This line gets the divisor for each number 1 to 1000

    for j in range(1,num+1):

This following if condition line checks for divisor of each number

<em>          if num%j==0: </em>

<em>               sum = sum + j </em>

The following if condition checks for perfect number

                   if num == sum:

                        print(str(num)+" is a perfect number")

5 0
3 years ago
In what year was the first world-wide web software created by tim berners-lee?
Elena L [17]
1989 <span>A graduate of Oxford University, Tim Berners-Lee invented the Web while at CERN, the European Particle Physics Laboratory, in </span>1989<span>. He wrote the first web client and server in </span>1990<span>.</span>
6 0
3 years ago
What is the full form of PDP​
PtichkaEL [24]

Answer:

<em>Plasma display panel </em>(PDP)

Explanation:

<em>Plasma display panel </em>(PDP) is a type of flat panel display that uses small cells containing electrically charged ionized gases or plasmas, to produce an image. PDP consists of millions of tiny gas-filled compartments, or cells, between two panels of glass with parallel electrodes deposited on their surfaces.

3 0
3 years ago
Other questions:
  • Suppose you're trying to remove the clamp from a ground strap that's connected to a battery. The clamp won't come loose. Which o
    14·2 answers
  • When does a kernel panic occur?
    12·2 answers
  • 5255555555555+55555555555555/1111*99442
    14·2 answers
  • Why is color theory important
    6·2 answers
  • The world wide web was originally conceived of as a(n) _____.
    14·1 answer
  • Which best describes what online reading tools aim to help readers do? *100 POINTS*
    9·2 answers
  • (2) Design pseudocode for a program that accepts numbers from the user until the special number 555 is entered (you should use a
    12·1 answer
  • According to the video, what kinds of projects would Computer Programmers be most likely to work on? Check all that apply.
    13·2 answers
  • ALSO PLZZZ HELP :P Suppose you are purchasing a game at a local retail store that comes on DVD. In order to install it on your l
    8·1 answer
  • The courts can adjust the penalties in lawsuits to reflect the fact that infringements may be _____.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!