Lab Activity 1.4A: Fixing Indentations in a Code Block Fixing Indentations in a main.py >- Terminal 1 if 14 > 7: print("Greater than") x = 2 print(x * 7) Code Block workspace $ 3 Lll Snippet 1.71 4 5 else: print("Less than") print(7) /2 7 Hint: Indentation for statements in a 8 block is dictated by the first statement's indentation level. The output of the correct syntax should be as shown in Snippet 1.72: Greater than 14 Snippet 1.72 Grading Complete each task listed below. Each task contains automated checks which are used to calculate your
Q: 3. Write a program to count the number of occurrences of any two vowels in succession in a line of…
A: Actually, program is an executable software that runs on a computer.
Q: 1 #include 2 3 int main() 4{ float y; 7 scanf("%f",&y); 8. 9. switch(y) { 10 11 case 1.1: 12 13 14…
A: The solution to the given problem is below.
Q: a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print…
A: I have provided a detailed code below.
Q: 2.2 what is the value of S1, S2 and S3 where S1, S2 and S3 type is float and each one is equal the…
A: Given: x=4, y=10, w=-10 ceil() = returns the nearest integer greater than the argument passed sqrt()…
Q: Examine the following code segment. What will be printed? If there are any errors indicate the…
A: Errors in program: Variable “i” which is used for loop traversing is not declared. This error is…
Q: Assume that nextWord is a String variable that has been given a String value consisting entirely of…
A: Assume that nextWord is a String variable that has been given a String value consisting entirely…
Q: The statements within which block are always executed at least once? do for…
A: There is one loop in which the block will always execute at least once regardless of the conditions.…
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Introduction :
Q: Python 3.7.4: Assume that C is a variable has been assigned a string value. Write an expression…
A: Since you have not specified what needs to be done in else part so we have included a print…
Q: #include using namespace std; int g = 100; int main() { int a; { int b; b = 20; a = 35; g…
A: Given, C++ code: #include <iostream> using namespace std; int g = 100; int main() { int…
Q: Which of the following is FALSE regarding the JS let? a. Variables defined with let work within…
A: a. Variables defined with let work within and outside the { and } braces Soln: variables defined…
Q: ex5-2.c Exercise 5.2 1 #define TRUE 1 #define FALSE O Collapse 3 short IsHoopy (int x) { short…
A: The output of the given program will be: 1 1 ping! pong!
Q: Write a Java program that prompts the user to enter a security code that matches a specific pattern.…
A: Thw java code is an given below : Java Code: import java.util.*;import java.io.*;import…
Q: Program10.java 1. Write a Java program that prompts the user to enter a security code that matches…
A: I provide the code along with output and code screenshot in Java
Q: 10. A operator increase a value stored in a number variable by 1. 11. Write the symbol of logical…
A: pls find the answers below.
Q: Question 1/20 What is the output of this code segment? 1. 0-9 2. 09.61 3. 04 double double 4. 0-4 5.…
A:
Q: Basic if-else expression. Jump to level 1 Write an expression that will cause the following code…
A: Solution: Algorithm Step 1: Input age from the user. Step 2: If the age is less than or equal to…
Q: Hello, I'm working on a lab and trying to execute the following code below but keep receiveing…
A: EXPLANATION: In some languages like C, Java, C++ uses indentation to looks the program pretty and…
Q: each) Consider the following declaration: char $1[16]="Rats", "s2 = "A1"; Indicate whether each of…
A: Hello student, hope you are doing good. The explanation of the above snippets is attached below.
Q: f a memory cell of 5 has an 8 value, how is the difference between entering the 5 value to cell…
A: Given statement syas that if a memory cell of 5 has an value, how the difference between entering…
Q: Write the output of the following C++ code? #include using namespace std; class CDummy { public:…
A: Write the output of the following C++ code? #include <iostream>using namespace std;class…
Q: Write a complete and syntactically correct Python program to solve the following problem: Write…
A: For this program Please maintain proper code spacing (indentation), just copy the code part and…
Q: Problem 2. (Keygen Program) Write a program called keygen.py that accepts lo (int) and hi (int) as…
A: It is defined as a small program used to generate serials number for software. To use it you should…
Q: Q Write a program to initialize a block of memory starting at 8A000H with English alphabet (A to Z)…
A: Ans:) I am using 8086 for this program to store the memory location for the alphabets. Please find…
Q: Arrays a1, a2… are populated as shown; display a[i] for each calls to arr; if a[i] less than or…
A: Declare and initialize the five arrays given in the question, as static. Inside the arr() method…
Q: What gets printed by executing the following code? def teststrings(): str1 = 'X University' str2 =…
A: If running same code it giving the error due to some mistake using " ' in same statement opening…
Q: PYTHON3 Complete the given function, encrypt_text that encrypts the variable text using the…
A: Solution: Given, The key will contain a word made up of the letters ‘u’ and ‘d’. The cipher…
Q: Question 40. Consider the following code chunk- 11 x <- 0 while(x < 4) { х «- вапрlе(1:3, 1) print…
A: The right answer is 'b'
Q: Create a java program that accepts five integers as arguments via the command line.The program…
A: Please give positive ratings for my efforts. Thanks. PROGRAM class Main { static int…
Q: Q5. a) Write a java program to demonstrate the use of mutable objects to find the Perimeter of a…
A: class Rectangle { // property of rectangle class int length,breadth; //Constructor…
Q: 34- The output of the following script is 27. * void smal(int x);int main() { int x = 13; smal (x);…
A: The above question is answered below
Q: Consider the following code snippet, and choose the best statement below: int cards[4]; for (int i…
A: If we store array element, from it size, then its was run successfully because there is no index out…
Q: In c void f (int *p, int * const q) { p=q *p=3; *p=4; }
A: The pointer in C language is a variable which stores the address of another variable.
Q: Assume int i[5] ={2,3,4,5,7}; Does the following statement work (yes/no)? cout << i…
A: A statement cout << i << endl; is meant to print the 5 numbers stored in the array i.…
Q: Assuming all values are initially zero, what are the values of A and B aft er executing this Verilog…
A: After executing the above Verilog code the values of A and B will be A=0 and B=1 Explanation: In…
Q: ii. Find errors in the following lines of code assuming included header files. Write correct form…
A: No termination condition has been specified in loop All compilation Errors will be removed
Q: Java Foundations: Please provide a basic exception program. Do not use input, output. Write…
A: ALGORITHM:-1. Take input for the grade from the user. 2. Check if the grade input by the user is…
Q: 1. Design a class, CipherDriver, that uses a repeating key to encode and decode a message read from…
A: import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.ArrayDeque;import…
Q: (in python 3) Take the username and password from a user and check the validity of the password…
A: 1. Take username and password as input from user 2. Check if password contains username, if yes…
Q: The statements within which block are always executed at least once? a for b do c…
A: Lets see the solution.
Q: 6. (18) Write a Java program (18 = 3(a) + 2(b) + 3(c) + 3(d) + 3(e) + 4(f) a. Define 2 String…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: When does an initial block statement become invalid?
A: Introduction: The always block denotes a process that runs indefinitely, whereas the initial block…
Q: /*Question: What is the output after run the following C++ statements, Assume all libraries already…
A: answer is
Q: What gets printed by executing the following code? def sets() : - {'a','b','c','d'}…
A: Question:-
Q: 1. Examine the following code segment. What will be printed?If there are any errors indicate the…
A: The given C++ code segment is: int a[8] ={16, 12, 10, 7, 15, 18, 17, 29}; int *ptr ; ptr = & a[…
Q: If, A = {3, 5, 7, 9} B = {2, 4, 6, 8, 10} C = {12, 14, 18, 20, 24} D = {21, 26, 31, 36} A.…
A: Given sets are: A = {3, 5, 7, 9} B = {2, 4, 6, 8, 10} C = {12, 14, 18, 20, 24} D = {21, 26, 31, 36}…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 4.18 Password requirements (JAVA) Websites commonly require a password that satisfies several requirements. Write a program in java that checks if an input string satisfies the following (error message is shown for each): At least 8 characters (Too short) At least one letter (Missing letter) At least one number (Missing number) At least one of these special characters: !, #, % (Missing special) Output OK, or all related error messages (in above order). If the input string is "Hello", the output is: Too short Missing number Missing special Hints: Declare a boolean variable for each requirement. Use a for loop to visit each character, setting the corresponding boolean to true if satisfied (length is done differently though). Use the functions Character.isLetter() and Character.isDigit() to detect if a character is a letter or a number. this is what i was able to do so far ......... Code starts here: import java.util.Scanner;public class Main { public static void…10 - In an examination, 500 students appeared. Out of these students, 38 % got A+ grade, 45 % got B+ and the remaining just passed. Assuming that no student failed, find the number of students who got A+, B+ and the number of students who just passed.(Python code)5.12.2: Switch statement to convert letters to Greek letters. Write a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print "Beta". For any other character, print "Unknown". Use fall-through as appropriate. End with newline. import java.util.Scanner; public class ConvertToGreek {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);char origLetter; origLetter = scnr.next().charAt(0); /* Your solution goes here */ }}
- 2.6.2: Bool in branching statements. C++ please. I am not sure why I cannot get the second one to work Write an if-else statement to describe an object. Print "Balloon" if isBalloon is true and isRed is false. Print "Red balloon" if isBalloon and isRed are both true. Print "Not a balloon" otherwise. End with newline. #include <iostream>using namespace std; int main() { bool isRed; bool isBalloon; cin >> isRed; cin >> isBalloon; isBalloon = (isRed && isBalloon); if (!isRed && isBalloon) { cout << "Balloon" << endl; } else if (isRed && isBalloon) { cout << "Red balloon" << endl; } else { cout << "Not a balloon" << endl; } return 0;} Not all tests passed checkTesting isBalloon = false, isRed = false Your output Not a balloon clearTesting isBalloon = true, isRed = false Output differs. See highlights below. Special…12. What is the output of the following program? (2, 3, 6, 8) #include #include #include #include using namespace std; int main() { double x, y; string str; x = 9.0; y = 3.2; cout (sqrt(pow (y, 4))) = " (sqrt(pow (y, 4))) << endl; str = "Predefined functions simplify programming code!"; cout << "Length of str = " << str.length() << endl; return 0; }Program10.java 1. Write a Java program that prompts the user to enter a security code that matches a specific pattern. Your program must approve the user's entry. The pattern consists of these characters in this sequence: 1 lower case character, 2 upper case characters, 2 or 3 digits, 2 lower case characters, 1 upper case character, 2 or 3 lower case characters, 2 digits.Refer to Appendix H beginning on pages 1176.Example Run Enter the code patternbHT482haQmo82Yes, bHT482haQmo82 matches the pattern Recheck the requirements before you submit!
- 1. Examine the following code segment. What will be printed?If there are any errors indicate the nature of each error.int a[7] = { 31, 12, 32, 14, 25, 16, 27 };int *ptr ;ptr = & a[ 2 ] ;for( i = 1; i <= 5; i = i + 2)cout << *( ptr + i ) ;cout << a[0] << *ptr << *ptr - 2 << *(ptr - 1)) << endl;Program10.java 1. Write a Java program that prompts the user to enter a security code that matches a specific pattern. Your program must approve the user's entry. The pattern consists of these characters in this sequence: A lower case character, two upper case characters, two or three digits, two lower case characters, an upper case character, 2 or 3 lower case characters, 2 digits.Refer to Appendix H beginning on pages 1176. Example Run Enter the code patternbHT482haQmo82Yes, bHT482haQmo82 matches the pattern Recheck the requirements before you submit!In C++: Examine the code segment. What will be printed? If there are any errors indicate the nature of each error. int a[7] = {31, 12, 32, 14, 25, 16, 27}; int *ptr; ptr = & a[2]; for ( i=1; i<=5; i=i+2) cout << *(ptr +i); cout << a[0] << *ptr << *ptr - 2 << *(ptr -1)) << endl;
- 3.27 LAB: Login name Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first six letters of the first name, followed by the first letter of the last name, an underscore (_), and then the last digit of the number (use the % operator). If the first name has less than six letters, then use all letters of the first name. Ex: If the input is: Michael Jordan 1991 the output is: Your login name: MichaeJ_1 Ex: If the input is: Nicole Smith 2024 the output is: Your login name: NicoleS_44.18 Password requirements Websites commonly require a password that satisfies several requirements. Write a program that checks if an input string satisfies the following (error message is shown for each): At least 8 characters (Too short) At least one letter (Missing letter) At least one number (Missing number) At least one of these special characters: !, #, % (Missing special) Output OK, or all related error messages (in above order). If the input string is "Hello", the output is: Too short Missing number Missing special Hints: Declare a boolean variable for each requirement. Use a for loop to visit each character, setting the corresponding boolean to true if satisfied (length is done differently though). Use the functions Character.isLetter() and Character.isDigit() to detect if a character is a letter or a number.Given following code and write comments for those code #include <stdio.h>#include <stdbool.h>#include <string.h>#include <ctype.h> #define MAX_PASSWORD_LENGTH 128#define MIN_PASSWORD_LENGTH 10#define ALLOW_PASSPHRASE true#define MIN_PHRASE_LENGTH 20#define OPTIONAL_TESTS_REQUIRED true#define MIN_OPTIONAL_TESTS_TO_PASS 4 bool isStrongPassword(char *password);void printTestResults(char *password, bool isPassphrase, int optionalTestsPassed); int main() { char passwords[][128] = { "password", "mypassword", "thisismypassword", "passssword", "This is my password phrase1", "Tinypw1", "Ireallydontlikehavingtomakeupnewpasswordsallthetime1", "Iloveyouxxxooo1", "Boom**********!", "IHATEPWORDS1!", "ihatepwords1!", "IHatePwords!", "IHatePwords", "my pass phrase does not need to pass tests", "short pass phrase", "x", "x1", "Zxcvbnmnas7",…