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
Studentka2010 [4]
3 years ago
15

Write the code (from to )using for loop andif elseif statementto accept themobile phone numbersof200 residents of Dubaiasstringa

nd check if thelength of eachmobile number is10. Depending on the first 3 characters of the mobile number,display the messagefrom the table below:First 3 charactersMessage“050”, “054”, “056”Etisalat number“052”,“055”, “058”DunumberFor anyother input(if the phone number is not a ten digit number or if it does not start with any of the above digits)Not a valid mobile number
Computers and Technology
1 answer:
Ksenya-84 [330]3 years ago
3 0

Answer:

In Python:

nos = int(input("How many phone number: "))

for i in range(1,nos+1):

   phn = input("Phone Number: ")

   if not len(phn) == 10:

       print("Invalid")

   else:

       charactersMessage = phn[0:3]

       if charactersMessage in ['050', '054', '056']:

           print("Etisalat Number")

       elif charactersMessage in ['052', '055', '058']:

           print("Du Number")

       else:

           print("Invalid")

Explanation:

Prompts the user for the frequency of phone numbers to check

nos = int(input("How many phone number: "))

This iterates through the phone numbers

for i in range(1,nos+1):

This prompts the user for phone number

phn = input("Phone Number: ")

Prints invalid id number length is not 10

<em>if not len(phn) == 10:</em>

<em>    print("Invalid")</em>

If otherwise

else:

This gets the first 3 characters

   charactersMessage = phn[0:3]

Prints Etisalat number if the characters are either 050, 054 or 056

<em>    if charactersMessage in ['050', '054', '056']:</em>

<em>        print("Etisalat Number")</em>

Prints Du number if the characters are either 052, 055 or 058

<em>    elif charactersMessage in ['052', '055', '058']:</em>

<em>        print("Du Number")</em>

Prints error if otherwise

<em>    else:</em>

<em>        print("Invalid")</em>

You might be interested in
What describes the current cloud landscape for business?
KonstantinChe [14]

Answer:

Organizations need to change the vast majority of their tasks to the cloud to stay competitive describes the current Cloud landscape for business

Explanation:

All cloud computing frameworks are effectively open over the web with minimal requirement for actual equipment other than cloud servers at the back end.

5 0
3 years ago
What is the most important reason to create a backup of your files somewhere other than your computer
Marizza181 [45]
The most important reason we should make a backup of our files on a USB or other device is in case our computer suddenly dies. If something in it goes bad and it stops working, you will have then lost everything on your computer. But, if you make a save, you can buy another computer and upload everything onto the new one.
6 0
4 years ago
A.)navigate
Vaselesa [24]

Answer:

start with what you know

Explanation:

you can learn a lot from it

7 0
3 years ago
a program p takes time proportional to log where nlogn is the input size. if the program takes 100 ms to process input of size 1
Eddi Din [679]

Answer:

The time is 4 \times 10^7 \ microseconds.

Explanation:

\ The \ requires \ time \ be \ t \ microseconds, \\\\\ \ formula: \\\\ time \propto \ nlog_n \Rightarrow \ time \ = \ knlogn \\\\

\ 10 \ = \ 100 \ log(100) \ \ \ \ \ \ \ \ \ k= 10^2 \ log\ ( \ 10^2\ ) \ k\\\\t=100,000,000 \log \ ( \ 100,000,000\ ) \ k = \ 10^8 \ log\ (\ 10^8\ )\ k \\\\\rightarrow \frac{t}{10} \ =\frac{10^8\ log \ (10^8)k}{10^2\ log\(10^2\ ) k} \\\\\rightarrow \frac{t}{10} \ =\frac{10^8\ log \ (10)\times 8 \times k}{10^2\ log\(10) \times 2 k} \\\\\rightarrow \frac{t}{10} \ =\ 4\times 10^6\\\\\rightarrow \ t \ =\ 4\times 10^6 \times 10 \\\\\rightarrow \ t \ =\ 4\times 10^7 \ microseconds \\\\

3 0
4 years ago
Given the following header: vector split(string target, string delimiter); implement the function split so that it returns a vec
suter [353]

Answer:

see explaination

Explanation:

#include <iostream>

#include <string>

#include <vector>

using namespace std;

vector<string> split(string, string);

int main()

{

vector<string> splitedStr;

string data;

string delimiter;

cout << "Enter string to split:" << endl;

getline(cin,data);

cout << "Enter delimiter string:" << endl;

getline(cin,delimiter);

splitedStr = split(data,delimiter);

cout << "\n";

cout << "The substrings are: ";

for(int i = 0; i < splitedStr.size(); i++)

cout << "\"" << splitedStr[i] << "\"" << ",";

cout << endl << endl;

cin >> data;

return 0;

}

vector<string> split(string target, string delimiter)

{

unsigned first = 0;

unsigned last;

vector<string> subStr;

while((last = target.find(delimiter, first)) != string::npos)

{

subStr.push_back(target.substr(first, last-first));

first = last + delimiter.length();

}

subStr.push_back(target.substr(first));

return subStr;

}

4 0
3 years ago
Other questions:
  • Which statements about Excel's FV function are correct?
    13·1 answer
  • What feature would be used to collect how many times users downloaded a product catalog?
    11·1 answer
  • Framing can create which of the following in a photograph? Mystery Saturation Aperture All of the above
    10·2 answers
  • Write a Java Program that can compute the mean, median, the highest, and the lowest of the students’ scores in a class. First, t
    6·1 answer
  • 52. Which of the following numbering system is used by the computer to display numbers? A. Binary B. Octal C. Decimal D. Hexadec
    12·2 answers
  • A-1 grdening supply is preparing a reprt to hand out to the customerez in pointes form only.why should the reprts writers avoid
    9·2 answers
  • Which line is most likely an error? A-“hello” B-hello C-“100” D-100
    6·2 answers
  • What underlying concept is edge computing based on?
    13·2 answers
  • Canada’s energy plan, named __________, makes three governmental agencies accountable for safeguarding Canada’s environment.
    5·1 answer
  • Question 3 of 25 In computer science, what is a developer? A. A person who organizes all the details of a project B. An individu
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!