Complete the program below which counts the number of capital letters in word? count = 0 for char in word: count = count + 1
Q: Find the error in each of the program segments and explain how to correct it:…
A: Given Data:- Find the error in each of the program segments and explain how to correct it:…
Q: int Secret (int num1, int num2) if (numl > 0) for (int i = 1; i 0) for (int i = 0; i <= num2; i++)…
A: The working of Secret Function is to return the multiple of 2 or 3. If the value of num1>0,…
Q: int n; int count = 0; while (n > 0) if (n & 1) ++count; n << 1; printf("Count is:%d", count);
A: Code #include<stdio.h> int main() { int n, count=0,max=0; scanf("%d",&n);…
Q: /TODO: Write method speeding here... ** * Return true if the given string contains a "pop" * string,…
A: Create a JAVA program that returns true when the given string contains a substring"pop" or contains…
Q: Assume that start and end are integers. Return the average all of the numbers from start to end…
A: def average(start,end): avg = (start+end)/2.0 return avg x = average(3,5)print('The average is…
Q: What will the program segments display? for (int count = 1; count <= 10; count++){ cout <<…
A: Lets see the solution.
Q: Assume j=5, what is the new value of j at the end of the following loop? for (int i = 8;i >= 0; i =…
A: First option "non of all" is the correct option. Explanation provided in the next step. Algorithm:…
Q: What values are returned by each of the following?a. Math.round(2.3)b. Math.round(2.7)c.…
A: Math.round() method In Java, the Math.round() function is used to round numbers to the nearest…
Q: The program segment has errors. Find as many as you can. // This code should average a set of…
A: Step 1:- Program:- #include <iostream>using namespace std;int main(){int numCount,…
Q: Instead of using scanf to get the strings, use getchar() to get characters one by one, and check for…
A: PROGRAM: //Including the header file #include<stdio.h> //Defining the main() function int…
Q: 1. Write a program that will find the Smallest, Largest and Average value in a collection of N…
A: As no language is mentioned I am solving this using C. #include <stdio.h>int main(){ int…
Q: In code below k = int i=2.j,k; j = i+1; k = i*j; cout<<k;
A: Given Code Snippet: int i=2,j,k; j = i + 1; k = i * j; cout<<k; We have to find…
Q: int s-0; int q-0; int count=0; while(count<=20) { if(count%5!=0) { q count/10; S-S+q; } count++; }…
A: In the code, the while loop running from 0 to 20. In the next, if condition, those which are not…
Q: #include int main() { for(int i=1;i<8;i++) if(i % 2 == 1) for (int j=1;j<=i;j++); printf("%d",i); }…
A: The output of the above code is: 1 333 55555 7777777
Q: Complete the program below which counts the number of capital letters in word? count = 0 for char in…
A: Python
Q: Make this code more efficient: numb = int(input("What is your favourite number? ")) name =…
A: The input() method reads the value from the input, converts into the string. So there is no need for…
Q: main() { int i = 45, c; c = multiply (i* 1000); printf ("\n%d", c); } check (int ch) { } if (ch >=…
A: In the place of multiply(i*1000) we should place check(i*1000) because there is no predefined…
Q: Program which accepts the user's first and last name and print them in reverse order with a space…
A: The Answer is
Q: Time left 1: Complete the program below which counts the number of capital letters in word? count =…
A: if char.isupper(): is correct.
Q: Complete the program below which counts the number of digits (0-9) in word? count0 for char in wordi
A: Solution Option D could be the answer if char>='0' and char<='9': it checks the ASCII value…
Q: int s=0; int q=0; int count=0; while(count<=20) { if(count%5!=0) { q=count/10; s=S+q; } count++; }…
A:
Q: What will the value of the answer variable be after the code segment below has been run. int…
A: Given Code segment int answer; int number4 = 244, number6 = 37, number11 = 1; answer = (…
Q: Complete the program below which counts the number of capital letters in word? count =0 for char in…
A: EXPLANATION: The upper() function is in general used for the purpose of converting all the…
Q: The following piece of code calculates base to the power of n (base"), please choose the correct…
A: Program public class basen { static void basen(int base,int n) { int result=1;…
Q: = In code below k int i=2.j.k j = i+1 k = i*j ;cout<<k
A: Here variable i, j and k are integer variable.
Q: #include int mystery3( const char 's1, const char 's2 ); int main() char string1[ 80 J;: char…
A:
Q: Complete the program shown in the 'Answer' box below by filling in the blank so that the program…
A: sill2([0, 0], [2, 3], -3).
Q: char t1[5] = "good"; char t2[5] = "boys"; char t3[15]; strepy (t3, t1); int nl = strlen (tl); int n2…
A: Description. 1- The output will come goodgood. How? 2- char t1[5] = "good"; // t1 is the string…
Q: A string with any message. Then, determine if the message contains the string, "hello" using array.…
A: Solution - Programming language used - C# All necessary comments are included in program code.…
Q: What does this program do? Please explain in detail. #include #define SIZE 80 size_t mystery2(…
A: #include <stdio.h>#define SIZE 80 size_t mystery2(const char *s);//declaring function mystery2…
Q: Given a string in which the same.character occurs in many consecutive character elements, Your task…
A: C++ Program for above : #include <iostream> using namespace std; int main() { //get…
Q: Write a program that displays all possible combinations for picking two numbers from integers 1 to…
A: Her is the Java program: public class Combinations{ public static void main(String[] args) { int…
Q: How many times 'p' value will be printed by running the following code? p = 2 while p <= 10: priht…
A: Explanation: Given: p = 2while p<=10: print("p=",p) p = p+2output:So clearly p will print 5…
Q: Question 5: generate a sequence of numbers that the result of dividing them by four will be 3 and…
A: #include <bits/stdc++.h>using namespace std; int main(){ for (int i = 1; i < 100; i++) {…
Q: Correct the following code so that it reads and finds the sum of 20 numbers. int count = 0;int sum =…
A: Corrected code The given code is int count = 0; int sum = 0;…
Q: Write program to print all ODD numbers beturen 7 te 77 that divided by 7 without remainder?
A: Computer programming or the code is the communication between computers and users. Creating a code…
Q: What is output by the following code segment ? (Supposed all variables are declared as int) count =…
A: The output of the given code segment is as follows: 0 00 000…
Q: Given code: int s=0; for ( int i=1; i<5; i++ ){ s = s + i ; } Which one is correct,…
A: After running the given code, the variable “s” holds the value of “10”. Hence, correct choice is…
Q: 3- int sum(int n); if (ne-e); return es else return 1;
A: Given :
Q: Complete the program below which counts the number of digits (0-9) in word? count = 0 for char in…
A: Here we have to check if the char lies between 0 and 9
Q: Write a program that prompts the user to input an integer between 0 and 35. If the number is less…
A: EXPLANATION: - The program declares int variable num. A prompt is given to user to enter a number…
Q: What is the final value of the variablenum given the following code fragment? int row - 10; int col…
A: Answer: The correct answer to the given question is-"51".
Q: Time Complete the program below which counts the number of lowercase letters in word? count = 0 for…
A: An array of characters is known as a string or word. Array is one the basic data structures that is…
Q: and drop to complete it: int n.m; printf("Enter the number"): scanf("%d",&n); for (int i=1;i<=m;i++)…
A: Here have to determine about correct sequence of given code.
Q: Using the integer entered by the user above, print out all the prime numbers between 2 and the…
A: import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc =…
Q: In the below code, if the initial or final character is a space, the answer is wrong. can you please…
A: The string is the collection of words or characters. I want to access the elements using the for…
Q: int count = for(int i = 0; i < 10; i++) for(int j = 0; j < i; j++) count++;
A: The value of the count after this code is run is 45. For proper explanation please refer to the…
Q: #include int *get( ) int y = 10; int *x = malloc ( return y;
A:
Step by step
Solved in 2 steps
- Complete the program below which counts the number of capital letters in word? count = 0 for char in word: count = count + 1 if char.upper(): if char.isupper() : if char >= "A" and char <= "z": if char.islower(): if word.isupper():Complete the function below that takes in three integers (a,b,c) and returns the number of integers between a and b (inclusive of the endpoints) that are divisible by c. Make sure it tests a and b for divisibility by c! In [ ]: defhow_many_divisible(a,b,c):counter=0# YOUR CODE HEREraiseNotImplementedError()returncounter In [ ]: assert how_many_divisible(10,20,5) == 3 assert how_many_divisible(30,77,7) == 7 PYTHON jYPYTERAll coding is done in Java. I am using IntelliJ Idea if it helps. 12. Bar Chart Write a program that asks the user to enter today's sales for five stores. The program should display a bar chart comparing each store's sales. Create each bar in the bar chart by displaying a row of asterisks. Each asterisk should represent $100 of sales. Example: Enter today's sales for store 1: 1000 [Enter] Enter today's sales for store 2: 1200 [Enter] Sales Bar Chart Store 1: ********** Store 2: ************
- # Program 1name = input()while not name.isalpha():name = input()print(name.capitalize())# Program 2count = 0sentence = input()for letter in sentence:if letter in "aAeEiIoOuU":count = count + 1print(count)# Program 3letter = input()word = "antidisestablishmentarianism"for char in word:if char == letter:print(char)# Program 4letter1 = input()letter2 = input()while letter2 == letter1:letter2 = input()alpha = "AbCdefGHiJKLmnoPqRsTUvwxyZ"location1 = alpha.find(letter1.lower())location2 = alpha.find(letter2.lower())if location1 == -1:letter1 = letter1.upper()else:letter1 = letter1.lower()if location2 == -1:letter2 = letter2.upper()else:letter2 = letter2.lower()alpha = alpha.replace(letter1, letter2)print(alpha) Turn in a written description of what each program above will do.Extreme Fizz BuzzFizz Buzz is a classic Computer Science problem about Selection. For an integer x, print:• “Fizz” if x is only divisible by 3,• “Buzz” if x is only divisible by 5,• “FizzBuzz” if x is divisible by both 3 and 5,• the number x if it is not divisible by both 3 and 5.This problem is the extreme version of Fizz Buzz. You are given a list of K distinct integers A and a list of K characters S. Both lists are numbered from 1 to K. The integer Ai corresponds to the character Si. Denote B as the subset of A. There will be a rule for each possible subset: if an integerx is only divisible by all elements in B, print a string which is the concatenation of the corresponding character of each element in B, sorted by the index in ascending order. However, if B is an empty subset, print the first digit of x instead. Does it look complicated? Do not worry, as it is just a generalization of the regular Fizz Buzz. For example, if A = [3, 5] and S = [F, B], you will get the normal Fizz…Questioin: Hidden Secret Problem! In this problem, you are given two names, you have to find whether one name is hidden into another. The restrictions are: You can change some uppercase letters to lower case and vice versa. You can add/remove spaces freely. You can permute the letters. And if both the names match exactly, then you can say that one name is hidden into another. Input Input starts with an integer T (≤ 100), denoting the number of test cases. Each case starts with two lines. Each line contains a name consists of upper/lower case English letters and spaces. You can assume that the length of any name is between 1 and 100(inclusive). Output For each case, print the case number and Yes if one name is hidden into another. Otherwise print No. Sample Input Output 3 Tom Marvolo Riddle I am Lord Voldemort I am not Harry Potter Hi Pretty Roar to man Harry and Voldemort Tom and Jerry and Harry Case 1: Yes Case 2: Yes Case 3: No And I want…
- 7. username_ends_with_digits This function decides whether a given username ends with some digits. It returns either True, if the username does end with digits, or False, if it does not. Check out the .isdigit method on strings! Sample runs should look like: >>> username_ends_with_digits("FunctionEnjoyer") False >>> username_ends_with_digits("this_username_95060") TrueThree numbersa. Write a program that reads three numbers and prints “all the same” if they are allthe same, “all different” if they are all different, and “neither” otherwise.b. Write a program that reads three numbers and prints “increasing” if they are inincreasing order, “decreasing” if they are in decreasing order, and “neither”otherwise. Here, “increasing” means “strictly increasing”, with each value largerthan its predecessor. The sequence 3 4 4 would not be considered increasing.c. Repeat part b. but before reading the numbers, ask the user whetherincreasing/decreasing should be “strict” or “lenient”. In lenient mode, thesequence 3 4 4 is increasing and the sequence 4 4 4 is both increasing anddecreasingQ1: The local Driver's License Office has asked you to write a program that grades the writ- ten portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1. A 2. D 3. B 4. B 5. C 6. B 7. A 8. B 9. C 10. D 11. A 12. C 13. D 14. B 15. D 16. C 17. C 18. A 19. D 20. B Your program should store the correct answers shown above in an array. It should ask the user to enter the student's answers for each of the 20 questions, and the answers should be stored in another array. After the student's answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions. Input Validation: Only accept the letters A, B, C, or…
- Exercise 2: The Hogwarts School of Witchcraft and Wizardry welcomes you! First-year students must go through the annual Sorting Ceremony. The Sorting Hat is a talking hat at Hogwarts that magically determines which of the four school Houses each new student belongs most to: Gryffindor Hufflepuff Ravenclaw ● Slytherin Your task is the following: Write a sortinghat.cpp program that asks the user some questions and places them into one of the four Houses based on their answers!char letter1; char letter2; letter1 = 'y'; while (letter1 <= 'z') { letter2 = 'a'; while (letter2 <= 'c'){ System.out.print("" + letter1 + letter2 + " "); ++letter2; } ++letter1; } For this code why did we use "" before and after in this line? System.out.print("" + letter1 + letter2 + " "); ++letter2; What if we don't use the blank quotation would the output be same? because I don't see the reason for putting those quotation mark.QUICK-BASIC64 In a 50-person class, students with grades below 70 are considered unsuccessful. Write an algorithm that calculates students who fail the exam. (Please explain everything the program in details and please check whether the program runs or not by using q- basic64. Thank you so much)