6.12 LAB: Warm up: Parsing strings (1) Prompt the user for a string that contains two strings separated by a comma. (1 pt) Examples of strings that can be accepted: Jill, Allen Jill , Allen Jill,Allen Ex: Enter input string: Jill, Allen (2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings. (2 pts)

Answers

Answer 1

Answer:

Explanation:

The following code is written in Python. It is a loop that asks the user for an input. If it contains a comma then it removes whitespace, splits it into two words, and prints each word seperately, and exits the loop. If it does not contain a comma then it prompts the user for another input.

while True:

   string = input("Enter input string: ")

   if ',' in string:

       string = string.replace(" ", '')

       string_split = string.split(',')

       print("First word: " + string_split[0])

       print("Second word: " + string_split[1])

       break

6.12 LAB: Warm Up: Parsing Strings (1) Prompt The User For A String That Contains Two Strings Separated

Related Questions

LAB: Contact list A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Assume that the list will always contain less than 20 word pairs. Ex: If the input is: 3 Joe 123-5432 Linda 983-4123 Frank 867-5309 Frank the output is: 867-5309

Answers

Answer:

The program in Python is as follows:

n = int(input(""))

numList = []

for i in range(n):

   word_pair = input("")

   numList.append(word_pair)

name = input("")

for i in range(n):

   if name.lower() in numList[i].lower():

       phone = numList[i].split(" ")

       print(phone[1])

   

Explanation:

This gets the number of the list, n

n = int(input(""))

This initializes list

numList = []

This iterates through n

for i in range(n):

This gets each word pair

   word_pair = input("")

This appends each word pair to the list

   numList.append(word_pair)

This gets a name to search from the user

name = input("")

This iterates through n

for i in range(n):

If the name exists in the list

   if name.lower() in numList[i].lower():

This gets the phone number associated to that name

       phone = numList[i].split(" ")

This prints the phone number

       print(phone[1])

what is the best plugin for subscription sites?

Answers

Answer:

Explanation:

MemberPress. MemberPress is a popular & well-supported membership plugin. ...

Restrict Content Pro. ...

Paid Memberships Pro. ...

Paid Member Subscriptions. ...

MemberMouse. ...

iThemes Exchange Membership Add-on. ...

Magic Members. ...

s2Member.

How many types of video
compressions__
a. 4
b. 2.
• c. 3
d. 6​

Answers

A. I think correct me if I’m wrong

To reduce the number of used digital outputs of the microcontroller, the display board is connected to the main board through the integrated circuit of the decoder, which converts binary coded decimal (BCD) values to signals for the seven-segment display. So, to show any number on the display you need to set the required BCD code on the microcontroller's outputs. Write a program to convert an integer number represented as a string to a BCD code required for the display. In the BCD code, every decimal digit is encoded with its four-bit binary value. Encoding all digits of the decimal number and concatenating the resulting codes into one string you will get a resulting BCD code. A space is used to separate digits in the BCD code and make it more readable. For example, a number 173 will be encoded to BCD as 0001 0111 0011.

Answers

Answer:

The program in Python is as follows:

BCD = ["0001","0010","0011","0100","0101","0110","0111"]

num = input("Decimal: ")

BCDValue = ""

valid = True

for i in range(len(num)):

   if num[i].isdigit():

       if(int(num[i])>= 0 and int(num[i])<8):

           BCDValue += BCD[i]+" "

       else:

           valid = False

           break;

   else:

       valid = False

       break;

if(valid):

   print(BCDValue)

else:

   print("Invalid")

Explanation:

This initializes the BCD corresponding value of the decimal number to a list

BCD = ["0001","0010","0011","0100","0101","0110","0111"]

This gets input for a decimal number

num = input("Decimal: ")

This initializes the required output (i.e. BCD value)  to an empty string

BCDValue = ""

This initializes valid input to True (Boolean)

valid = True

This iterates through the input string

for i in range(len(num)):

This checks if each character of the string is a number

   if num[i].isdigit():

If yes, it checks if the number ranges from 0 to 7 (inclusive)

       if(int(num[i])>= 0 and int(num[i])<8):

If yes, the corresponding BCD value is calculated

           BCDValue += BCD[i]+" "

       else:

If otherwise, then the input string is invalid and the loop is exited

           valid = False

           break;

If otherwise, then the input string is invalid and the loop is exited

   else:

       valid = False

       break;

If valid is True, then the BCD value is printed

if(valid):

   print(BCDValue)

If otherwise, it prints Invalid

else:

   print("Invalid")

Create a public class named InsertionSorter. It should provide one class method sort. sort accepts an array of Comparables and sorts them in ascending order. You should sort the array in place, meaning that you modify the original array, and return the number of swaps required to sort the array as an int. That's how we'll know that you've correctly implemented insertion sort. If the array is null you should throw an IllegalArgumentException. You can assume that the array does not contain any null values.
To receive credit implement insertion sort as follows. Have the sorted part start at the left and grow to the right. Each step takes the left-most value from the unsorted part of the array and move it leftward, swapping elements until it is in the correct place. Do not swap equal values. This will make your sort unstable and cause you to fail the test suites.

Answers

Answer:

Explanation:

The following code is written in Java it uses an insertion sort algorithm to sort a Comparable array that is passed as an input. The method itseld returns the number of changes that need to be made in order to fully sort the array.

class InsertionSorter {

   private static Object IllegalArgumentException;

   public static void main(String[] args) throws Throwable {

      Comparable[] myarr = {1, 6, 15, 2, 5, 3, 8, 33, 10};

      System.out.println(insertionSort(myarr));

   }

   public static int insertionSort(Comparable[] array) throws Throwable {

       try {

           int i, j;

           Comparable newValue;

           int count = 0;

           for (i = 1; i < array.length; i++) {

               newValue = array[i];

               j = i;

               while (j > 0 && (array[j - 1].compareTo(newValue)>0)) {

                   array[j] = array[j - 1];

                   j--;

                   count += 1;

               }

               array[j] = newValue;

           }

           return count;

       } catch (Exception e) {

           throw (Throwable) IllegalArgumentException;

       }

   }

}

________________risk in payment system requires improvements in the security framework. [ ]
a)Fraud or mistakes b)Privacy issues c)Credit risk d) All of the above.

Please write the answer for 15 points

Answers

Answer:

D. all of the above

Explanation:

sana nakatulong

which two of the following are goals of the cognitive therapist

Answers

provide answer options and i will try to help in the comments

A collection of computers and other hardware devices that are connected together to share hardware, software, and data, as well as to communicate electronically with one another? Explain.

Answers

Here you go.....................

The L-exclusion problem is a variant of the starvation-free mutual exclusion problem. We make two changes: as many as L threads may be in the critical section at the same time, and fewer than L threads might fail (by halting) in the critical section. An implementation must satisfy the following conditions:_____.
L-Exclusion: At any time, at most L threads are in the critical section.
L-Starvation-Freedom: As long as fewer than L threads are in the critical section, then some thread that wants to enter the critical section will eventually succeed (even if some threads in the critical section have halted).
Modify the n-process Bakery mutual exclusion algorithm to turn it into an L-exclusion algorithm. Do not consider atomic operations in your answer. You can provide a pseudo-code solution or written solution.

Answers

Answer:

The solution is as follows.

class LFilters implements Lock {

int[] lvl;

int[] vic;

public LFilters(int n, int l) {

lvl = new int[max(n-l+1,0)];

vic = new int[max(n-l+1,0)];

for (int i = 0; i < n-l+1; i++) {

lvl[i] = 0;

}

}

public void lock() {

int me = ThreadID.get();

for (int i = 1; i < n-l+1; i++) { // attempt level i

lvl[me] = i;

vic[i] = me;

// rotate while conflicts exist

int above = l+1;

while (above > l && vic[i] == me) {

above = 0;

for (int k = 0; k < n; k++) {

if (lvl[k] >= i) above++;

}

}

}

}

public void unlock() {

int me = ThreadID.get();

lvl[me] = 0;

}

}

Explanation:

The code is presented above in which the a class is formed which has two variables, lvl and vic. It performs the operation of lock as indicated above.

2.1 A friend is interested in installing a wireless LAN in her small business. She has about a dozen employees. You are setting up an 802.11g wireless access point for her business. Your aggregate throughput is only about 6 Mbps. List at least two possible reasons for this low throughput.

Answers

Answer:

The two reasons for low throughput are as follows:

1-Low throughput is due to the fall of throughput is more with distance from the source.

2-The throughput is shared by multiple hosts and they are all using at the same time.

Explanation:

As the aggregate throughput of the 802.11g wireless access point is same, thus when you go farther from it or the number of uses increases, the overall value of individual throughput decreases.

Which line of code will use the overloaded multiplication operation?

class num:
def __init__(self,a):
self.number = a

def __add__(self,b):
return self.number + 2 * b.number

def __mul__(self, b):
return self.number + b.number

def __pow__(self, b):
return self.number + b.number

# main program
numA = num(5)
numB = num(10)

Which line of code will use the overloaded multiplication operation?

class num:
def __init__(self,a):
self.number = a

def __add__(self,b):
return self.number + 2 * b.number

def __mul__(self, b):
return self.number + b.number

def __pow__(self, b):
return self.number + b.number

# main program
numA = num(5)
numB = num(10)

a) product = numA * numB
b) product = numA.multiply(numB)
c) product = numA.mul(numB

Answers

For multiplication one: product = numA * numB

For the addition: result = numA + numB

got 100 on this ez

(searched all over internet and no one had the answer lul hope this helps!)

Answer: First option: product = numA * numB

second option-numA + numB

Explanation:

answer any one: write a computer program:​

Answers

Answer:

hope this helps you look it once.

Which of these is a type of social engineering attack?
Select one:
O Packet Sniffer
O Port Scan
O Phishing
O Ping Sweep​

Answers

Answer:

phishing

Explanation:

all others are different ways of Hacking.

are you interested in cyber security?

draw a flowchart and write the algorithm to find even number between 1 to 50​

Answers

Answer:We Explain the flowchart in following images given below..

Please hit a like and thanks

La herramienta …………………………... en el programa CorelDraw X8, está conformado por texto artístico.

Answers

Answer

what are you talking about, thats crazy!

Explanation:

no seriasly, what are you taking about


Explain working principle of computer.​

Answers

Explanation:

The working principle of the computer system. Computers do the work primarily in the machine and we can not see, a control center that converts the information data input to output. This control center, called the central processing unit (CPU), How Computers Work is a very complex system.

hope it is helpful to you

How can you ensure that the website you are using is secured?
A.
website begins with http://
B.
website begins with https:// and has a green padlock
C.
website doesn’t have any padlock icon
D.
website has a red padlock icon

Answers

The answer is B: website begins with https:// and has a green padlock

Write a C program that right shifts an integer variable 4 bits. The program should print the integer in bits before and after the shift operation. Does your system place 0s or 1s in the vacated bits?

Answers

Solution :

#include<[tex]$\text{stdio.h}$[/tex]>

#include<conio.h>

void dec_bin(int number) {

[tex]$\text{int x, y}$[/tex];

x = y = 0;

for(y = 15; y >= 0; y--) {

x = number / (1 << y);

number = number - x * (1 << y);

printf("%d", x);

}

printf("\n");

}

int main()

{

int k;

printf("Enter No u wanted to right shift by 4 : ");

scanf("%d",&k);

dec_bin(k);

k = k>>4; // right shift here.

dec_bin(k);

getch();

return 0;

}

This program exercise #4 wants the user to write a program in python that contains a list of movies titles, years and movie rating. You will need to display a menu option that allows the user to list all of the movies, add a movie, delete a movie and exit out of the program. This will be done using lists and the functions to add an element to a list and how to delete an element to a list. The program should be written utilizing functions in python for the main function, the display_menu function, the delete function, the add function and the list movie function. You can place this all in one python file or include them in various python files that include them into the main program. Let me know if you have any questions with this exercise. Output Screen: COMMAND MENU list - List all movies add - Add a movie del - Delete a movie exit - Exit program Command List: list 1. Monty Python and the Holy Grail, 1979, R 2. On the Waterfront, 1954, PG 3. Cat on a Hot Tim Roof, 1958, R Command: add Name: Gone with the Wind Year: 1939 Rating: PG Gone with the Wind was added.

Answers

Answer:

The program in Python is as follows:

def display_menu(titles,years,ratings):

   for i in range(len(titles)):

       print(str(i+1)+". "+titles[i]+", "+str(years[i])+", "+str(ratings[i]))

   

def delete(titles,years,ratings):

   del_item = input("Movie: ")

   if del_item in titles:

       print(del_item,"was deleted")

       index = titles.index(del_item)

       titles.pop(index)

       years.pop(index)

       ratings.pop(index)

   return(titles,years,ratings)

   

def add(titles,years,ratings):

   title = input("Title: ")

   year = int(input("Year: "))

   rating = int(input("Ratings: "))

   print(title,"was added")

   titles.append(title)

   years.append(year)

   ratings.append(rating)

   

   return(titles,years,ratings)

titles = []

years = []

ratings = []

print("COMMAND MENU list\nlist - List movies\nadd - Add movie del\ndel - Delete movie exit\nexit - Exit program")

menu = (input("Command List: "))

while(menu.lower() == "list" or menu.lower() == "add" or menu.lower() == "del"):

   if menu.lower() == "list":

       display_menu(titles,years,ratings)

   elif menu.lower() == "add":

       titles, years, ratings = add(titles,years,ratings)

   elif menu.lower() == "del":

       titles, years, ratings = delete(titles,years,ratings)

   menu = (input("Command List: "))

   elif menu.lower() == "exit":

       break

print("Exited!!!")

Explanation:

See attachment for complete program where comments are used to explain some lines of the program

C++ coding, help
In this program you will be reading numbers from a file. You will validate the numbers and calculate the average of all of the valid numbers.
Your program will read in a file with numbers. The numbers will be of type double.
The numbers should be in the range from 0 to 110 (inclusive). You need to count all of the numbers between 0 and 110. You also need to calculate the average of these numbers.
If a number is not valid (that is, it is less than 0 or greater than 110) you need to count it (as a count of invalid values) and you need to write out the number to a file called "invalid-numbers.txt". Values written to file invalid-numbers.txt should be in fixed format with two digits to the right of the decimal point.
As you did in lab lesson 7 part 1 you need to read in the input file name using cin.
The output from your program will be written to cout. The output must contain the file being processed, the total number of values read in from the file, the number of invalid values read in, the number of valid values read in.
The last thing you need to output is either the average of the valid values or an error message. The average must have two digits of precision to the right of the decimal point and must be in fixed format. If there is not valid average you should output the message:
An average cannot be calculated
In what case would you display this message?
If the input file cannot be opened, you will need to output a message. Assume the input file name is badinput.txt and it cannot be opened. You will display the following error message to cout
File "badinput.txt" could not be opened
Here is an example of a working program:
Assume the file name read in from cin is:
input.txt
and that input.txt contains:
-12
0
98.5
100
105.5
93.5
88
75
-3
111
89
-12
Your program would output the following:
Reading from file "input.txt"
Total values: 12
Invalid values: 4
Valid values: 8
Average of valid values: 81.19
The contents written out to file invalid-numbers.txt are:
-12
-3
111
-12
You are reading from an input file and you are writing to an output file. Make sure you close both files after you are finished using them. You must do this in your program, you cannot just let the operating system close the files for you.
For tests where there is output written to an output file the contents of the output file will determine if you passed that test or not. For cases where you have written out to cout the tests will check the output sent to cout. In some cases output will be written to a file and to cout. When this is the case the test will be run twice with the same input. Once to test cout and once to test the contents of the output file. An example of this would be tests 2 and 3. Both use the same input file. Test 2 check the output written to cout and test 3 checks the output written to the file invalid-numbers.txt.

Answers

Answer:

The program in C++ is as follows:

#include <fstream>

#include <iostream>

#include <iomanip>

using namespace std;

int main() {

 string filename;

 cout<<"Filename: ";

 cin>>filename;

 ifstream inFile(filename);

 if(!inFile) {

   cout << endl << "Cannot open file " << filename;

   return 1;  }  

 ofstream fout;

 ifstream fin;

 fin.open("invalid-numbers.txt");  

 fout.open ("invalid-numbers.txt",ios::app);  

 double sum = 0; int valid = 0; int invalid = 0;

 double num = 0;

 while(!inFile.eof()) {

   inFile >> num;

   if(num >= 0 && num<=110){   sum+=num; valid++; }

else{ invalid++;

if(fin.is_open()){

   fout<<fixed<<setprecision(2)<<num<<"\n";    }  }  }

 fin.close();

 fout.close();

 inFile.close();

 cout<<"Total values: "<<valid+invalid<<endl;

 cout<<"Invalid values: "<<invalid<<endl;

 cout<<"Valid values: "<<valid<<endl;

 cout<<"Average of valid values: "<<fixed<<setprecision(2)<<sum/valid<<endl;    

 double inv;

 ifstream inFiles("invalid-numbers.txt");

 while(!inFiles.eof()) {

   inFiles >> inv;

   cout<<inv<<"\n";

}

inFiles.close();

 return 0;

}

Explanation:

See attachment for source file where comments are used to explain each line

Can someone plz answer these questions

Answers

Answer:

11001100 = 204

11111111 = 255

Explanation:

For 11001100:

1*2⁷ + 1*2⁶ + 0*2⁵ + 0*2⁴ + 1*2³ + 1*2² + 0*2¹ + 0*2⁰ = 204

Just replace 1's by 0's in the following calculation to do it for every 8 bit number:

1*2⁷ + 1*2⁶ + 1*2⁵ + 1*2⁴ + 1*2³ + 1*2² + 1*2¹ + 1*2⁰ = 255

If you don't want to do the calculation yourself, you can set the windows calculator in programmer mode, then select binary and key in the number.

determine if each statement is true or false:

graphics designers are responsible for communicating a message: TRUE

portfolios are not important for graphic design careers: FALSE


professional graphic designers join the american institute of graphic arts: TRUE

Answers

Answer:

TRUE

FALSE

TRUE

Explanation:

Graphic designers are sometimes known as communications designers. They communicate information through the creation of visuals. This can be in the form of logos, fliers, animations and so many others.

1) Graphic designers are responsible for communicating a message. This is TRUE because this is the top reason for their profession. They communicate messages/ pass information through their designs to the desired audience.

2) Portfolios are not important for graphic design careers. This is FALSE. Having portfolios is necessary for graphic designers. This enables them to have a record of all their work so as to showcase to new clients that may set them up for more jobs.

3) Professional graphic designers join the American Institute of Graphic Arts. This is TRUE. The American Institute for Graphic Arts is a professional organization meant for people in the design industry and this includes graphic designers.

What’s unique about windows 8 compared to earlier windows

Answers

New Interface, features like start screen, faster boot time, dynamic desktop, improved search function, windows love syncing, windows to go, and improved security.

Which of the following is not the disadvantage of closed
network model?
Select one:
O Flexibility
O Public network connection
O Support
O External access​

Answers

Answer:

public network connection

Answer:

public network connection

List the types of infrared we have

Answers

Answer: infared types like the sun, sun light, heat lamps, and radiators

What is the location used by users to configure delegate access on their own mailboxes? Backstage view > Account Settings Backstage view > Permissions O Inbox > Permissions O Calendar > Permissions​

Answers

Answer:

A: Backstage view > Account Settings

Explanation:

Implement the function _isPalindrome() in palindrome.py, using recursion, such that it returns True if the argument s is a palindrome (ie, reads the same forwards and backwards), and False otherwise. You may assume that s is all lower case and doesn’t include any whitespace characters.

Answers

Answer:

The function is as follows:

def _isPalindrome(stri) :

  if len(stri) == 0:

     return True

  if stri[0] == stri[len(stri) - 1]:

     return _isPalindrome(stri[1:len(stri) - 1])

  else:

     return False

Explanation:

This defines the function

def _isPalindrome(stri) :

If the string is empty, then it is palindrome

  if len(stri) == 0:

     return True

This checks if the characters at alternate positions are the same.

If yes, it calls the function to check for other characters

  if stri[0] == stri[len(stri) - 1]:

     return _isPalindrome(stri[1:len(stri) - 1])

If otherwise, the string is not palindrome

  else:

     return False

Page Setup options are important for printing a PowerPoint presentation a certain way. The button for the Page Setup dialog box is found in the
File tab.
Home tab.
Design tab.
Slide Show tab.

Answers

Answer: Design tab

Explanation:

The page setup simply refers to the parameters which are defined by a particular user which is vital in knowing how a printed page will appear. It allows user to customize the page layout. The parameters include size, page orientation, quality of print,margin etc.

It should be noted that page setup options are vital for printing a PowerPoint presentation in a certain way and the button for the Page Setup dialog box can be found in the design tab.

Apart from the OOPs concepts learned in this lesson, identify additional concepts and write an essay on their functions. Explain how they are used in a program.
PLSSSS HELLP MEEE ASAP!!!!​

Answers

Explanation:

Object Oriented Programming (OOPS or OOPS for Object Oriented Programming System) is the most widely used programming paradigm today. While most of the popular programming languages are multi-paradigm, the support to object-oriented programming is fundamental for large projects. Of course OOP has its share of critics. Nowadays functional programming seems the new trendy approach. Still, criticism is due mostly to misuse of OOP.

Fill in the blanks using A to J below.

1. ----- = command driven

2. ----- = general purpose

3. ----- = custom written

4. ----- = icon

5. ----- = menu driven

6. ----- = integrated software

7. ----- = desktop

8. ----- = system software

9. ----- = Window

10. ----- = software house

A. Software written to meet the specific needs of a company.

B. Related specialized programs combined in a unified package.

C. This software can be adapted for specific needs but is not written for any specific business purpose.

D. This interface requires the user to type in codes or words.

E. A pictorial representation of a file, folder, program, task or procedure.

F. This interface allows you to move a mouse or cursor to make a selection.

G. A rectangle that displays information on the screen.

H. A visual background over which all your work is done.

I. This software notifies the computer to begin sending data to the appropriate program to get a document printed.

J. A company that specializes in writing software.

Answers

Answer:

A.software written to meet specific needs of company

B.Related specialized programs combined in a unified package

Other Questions
Find the indicated measure. Round answers to the nearest hundredth. Which type of tectonic plate interaction forms a mid ocean ridge? Which of the following types of meter is most common in Western music?irregularfastOOOOlongregular On a farm, the farmer decides to give pizza to her 18 ducks as a special treat. She orders 3 pizzas, and the total price is $26.28. What is the unit price of each pizza? $4.38 $8.76 $23.28 $78.84 Show how artificial selection could be used to develop a new breed of wheat with higher fiber content help me please!:(this is geometry How do you find the volume of a cylinder?? government as an academic field of study what is x=16? 2348 Which statement best completes the timeline?Earlycivilizationsdevelop inancientEgyptThe Kushcivilizationcontrols theNile RiverregionCarthagebuilds anorthernAfricanempire?Islambecomes themajor religionof northernAfricaA. The Abbasid caliphate conquers northern Africa.B. European colonists conquer northern Africa.C. Alexander the Great conquers northern Africa.D. The Roman Empire conquers northern Africa. Select all the expressions that are equivalent to x2+4x. (^2 means raising something to the 2nd power.) The graph shows the distance traveled by an Olympic-level sprinter over time during a race.Find the slope of the line, and complete the sentences below.100-meter Racety10080Distance (m)604020002104 6 8Time (s)The slope of the line is Choose..The slope representsChoose. If you answer this fast I will rate 5 stars, brainly, heart for a thanks here's the link- https://www.poemhunter.com/donald-bruce-dawe/what is the MLA or you can call it work site.the poem is called Homecoming. What if social media was never created? Think about how this would affect you and the world around you. Would this be a positive or negative switch? Be detailed when providing your answer. The sequence of mRNA is AGUACA. Which of these is the sequence oftRNA? *UCAUGUAGTACAAGUACATCATGT If you place a 28-foot ladder against the top of a 22 foot building Which fraction contains the largest molecules?A) dieselB)gasoline C)kerosene? he controller of Wildhorse Industries has collected the following monthly expense data for use in analyzing the cost behavior of maintenance costs. Month Total Maintenance Costs Total Machine Hours January $2,925 3,880 February 3,324 4,432 March 3,989 6,648 April 4,986 8,753 May 3,546 5,540 June 5,420 8,870 (a1) Determine the variable-cost components using the high-low method. (Round answer to 2 decimal places e.g. 2.25.) Variable cost per machine hour $ I need help with this elimination problem a spinner has 8 equal sections,6 are green .find probability that will land on green