Computers and Technology
I need help with the following c program:(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,AllenEx: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)Ex:Enter input string:Jill AllenError: No comma in string.Enter input string:Jill, Allen(3) Extract the two words from the input string and remove any spaces. Store the strings in two separate variables and output the strings. (2 pts)Ex:Enter input string:Jill, AllenFirst word: JillSecond word: Allen(4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit. (2 pts)Ex:Enter input string:Jill, AllenFirst word: JillSecond word: AllenEnter input string:Golden , MonkeyFirst word: GoldenSecond word: MonkeyEnter input string:Washington,DCFirst word: WashingtonSecond word: DCEnter input string:q
PLEASE HELP!!!!Write a function that takes a number of rows, a number of columns, and a string and returns a two-dimensional array of the dimensions specified where each element is the string given. Sample run:mat = fill_str(4, 2, "20")print(mat)Prints the following:[['2', '20'], ['2', '20'], ['2', '20'], ['20', '20']]
1. The following pseudocode tests how quickly a user can type a given sentence without making any mistakes. The statement finishTime = time.clock() returns wall-clock seconds elapsed since the first call to this function and places the answer in finishTime.import timesentence = "The quick brown fox jumped over the lazy dog"n = len(sentence)print ("Sentence to type: ", sentence)errorFlag = Falseprint ("Press Enter when youre ready to start typing! Press Enter when finished ")ready = input()print(Go)time.clock() # you can call the function without returning a value mySentence = input()finishTime = time.clock()if mySentence sentence then errorFlag = TrueendiffinishTime = round(finishTime,1)if errorFlag == True then print ("You made one or more errors")else print ("Total time taken ",totalTime, "seconds")endif (a) What does the statement import time do? [1] (b) What type of variable is each of the following? [4] (i) errorFlag (ii) n (iii) totalTime (iv) mySentence (c) What does line 15 do? [1] (d) Alter the program so that instead of storing the sentence The quick brown fox jumped over the lazy dog, the user can enter the sentence on which they will be timed. [3]2. A customer entering security details when logging into a bank website is asked to enter three random characters from their password, which must be at least 8 characters long and contain no spaces.Assume that in this case the password is HC&dt2016. The letters are then compared to those in the password held on file for that customer. Kelly has a first attempt at writing pseudocode for the algorithm.import randomcustomerPassword = "HC&dt2016" #(assume read from file)numChars = len(customerPassword)index1 = random.randint(0, numChars-1)index2 = random.randint(0, numChars-1)index3 = random.randint(0, numChars-1)print ("Please enter characters ", index1+1, index2+1, index3+1, "from your password.")print ("Press enter after each character: ")char1 = input()char2 = input()char3 = input()if print("Welcome")elseprint ("Password incorrect") (a) What value is assigned to numChars at line 3? [1] (b) Complete the if statement at line 12. [3] (c) What possible values may be assigned to index1 at line 4? [1] (d) Describe two weaknesses of this algorithm. [2]2. Write pseudocode for one or more selection statements to decide whether a year is a Leap year. The rules are: A year is generally a Leap Year if it is divisible by 4, except that if the year is divisible by 100, it is not a Leap year, unless it is also divisible by 400. Thus 1900 was not a Leap Year, but 2000 was a Leap year. [4]