What is the output of this expression? word = 'object oriented' print word[0] print word[5] print word[-1] SyntaxError: invalid syntax O 0, t, n, d O 0, t, n O 0, t, d
Q: PYTHON HOMEWORK QUESTION def area(side1, side2): return side1 * side2 s1 = 12 s2 = 6 Select…
A: Here, a function area is defined which is accepting 2 arguments and then returning the area by…
Q: Art.java In this part you will create a program Art.java that produces a recursive drawing of the…
A: Explanation : Note : For simplicity purpose I have drawn lines just 300 times You can change it…
Q: my_func is a function as follows. What is the value of a at the end of the code beneath? function a…
A: answer is
Q: Palindrome Checker create a JavaScript program that checks if phrases entered by the user are…
A: In this question we have to write a JavaScript code for the plaindrome check Let's code and hope…
Q: JAVA Programming Problem 5 – CharacterArray Write a program which will store the following string…
A: i wll provide two solutions for this question public class CharacterArray {public static void…
Q: Hangman Game in C++ The instructions are in the pictures. This is what it is supposed to look like:…
A: Note: As you have not uploaded the randword.h and randword.cpp file, I am taking the example of two…
Q: void funOne(int a, int& b, char v); void main() { int num1=10; char ch='A'; funOne(num1,…
A: Invalid
Q: Instructions: In C++ Programming, write a program that calculates and prints the monthly paycheck…
A: 1. Start the program.2. Define constants for tax rates and deductions including Federal Income Tax,…
Q: remove_substring_from_string(s, substr): This function takes two strings s and substr as input. It…
A: PROGRAM CODE: # start definition of function to remove substringdef remove_substring_from_string(s,…
Q: char lastChar(const char *str){ char last; //loop over the string and go uptill end of the…
A: char lastChar(const char *str){ char last; //loop over the string and go uptill end of the…
Q: def longest_chain (lst: List[int]) -> int: Given a list of integers, return the length of the…
A: Please refer to the following steps for the complete solution to the problem above.
Q: Magic Number Code question::-1. A number is said to be a magic number, if summing the digits of the…
A: In this question we need to write a program to determine whether a given number is a Magic number or…
Q: C++ code needed Design an application that accepts 10 numbers and displays them in descending…
A: Introduction: Information is considered to be in descending order if it is arranged from highest to…
Q: Programming Language: C++ 1. A constant cannot be passed by reference. = true or false?
A: Explanation: a constant can be passed by reference in c++. Example: void swapNums(int &x, int…
Q: C Program solve Pointer Arithmetic Write a program that accepts a string and print the reversed form…
A: code : - #include <stdio.h>int main(){ // two char array to store input string and Reverse…
Q: java Assume the following variables have been declared: word is a String variable that has been…
A: we can use substring method of java for this Below is the implementation:
Q: boolean[] b = new boolean[2]; System.out.printIn(b[0]); displays O an error occurs O false a random…
A: The correct answer along with the explanation is given below:
Q: In this lab, you complete a partially written Python program that includes a function that returns a…
A: Process: Calculator.py - This program performs arithmetic, ( +. -, *. / ) on two numbers.Input:…
Q: 7. The Jumpin' Jive coffee shop charges $2 for a cup of coffee and offers the add-ins shown in Table…
A: Solution - Programming Language - C++ All necessary comments are included in program code.…
Q: True or FalseReference variables can be used only to reference objects.
A: The answer is false.
Q: Python Returning Funtion function name: bound_0_to_100 parameters:a number grade returns: the grade…
A: Pseudocode: Define a function named bound_0_to_100 having grade as its parameter If the grade is…
Q: Please draw the correct flowchart for this game ?
A: The flowchart is given below along with output of code
Q: The prices of children's books, novels and dictionaries sold in a stationery are determined as…
A: Actually, program is a executable software that runs on a computer.
Q: Usage: mortgagepmt [-s] -r rate [-d downpayment] price In this assignment, you are asked to do a…
A: Here is the answer below:-
Q: What is the output of this subprogram? char a=65; a+=3; cout <<a;
A: Given To find the output of c++ program char a=65; a+=3; cout<<a;
Q: Suppose x and y are int variables and symbol is a char variable. Assume the following input data: 4.…
A: According to the Question below the Solution:
Q: Python Language Useful websites: : http://en.wikipedia.org/wiki/Radix…
A: Task :- Write a Python function to find the kth digit for given number. Python program :- def…
Q: -Language The goal of this problem is to find the smallest integer in a list of numbers. To help…
A: C is a general-purpose computer programming language.
Q: Static Variable: a variable whose lifetime is the lifetime of the program (static int x;) Dynamic…
A: Given: Static Variable: a variable whose lifetime is the lifetime of the program (static int x;)…
Q: get_user_input(message, sentinel): The parameter message is the string message to request an integer…
A: Required: get_user_input(message, sentinel): The parameter message is the string message to…
Q: . Find the error in the following code: names = ('Alice','Bob','Melanie',’George’)names[2] =…
A: Here names is list. names = ('Alice','Bob','Melanie',’George’) names[2] = 'Melanie'
Q: LISP Programming only A function that generates a random day of the week, then displays a message…
A: In this Lisp program, we'll write a function that chooses a random day of the week and outputs a…
Q: In C++ Find the five errors. For each error, state the line number, explain the error and show a…
A: Answer:)
Q: char str1[50] = “Programming in C++ !!!”; char str2[13] = “Hello World\n”; Evaluate the following:…
A: In step 2, I have provided answer with brief explanation ---------- In the next step , I have…
Q: Compare Numbers - Python Language please! Programming challenge description: Little Tommy is in…
A: Step 1 : STARTStep 2 : implement the function compare_numbersStep 3 : input 2 numbersStep 4 : store…
Q: Consider the following pseudo code, Method func() { PRINT “This is recursive function" func() }…
A: According the Question below the solution:
Q: Create a program that converts the given number in the binary system to the decimal system . A…
A: Answer is
Q: int main() { string str; int count = 0; // user input cout > str; int n =…
A: C program to solve the given problem is below.
Q: C++ PROGRAMMING Create a C++ program that accepts an English sentence and converts it to Pig Latin.…
A: Output :-
Q: Write a function in Java that implements the following logic: Given a number n, return true if n is…
A: I have provided JAVA CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT---------
Q: python question: Write a code that takes a sentence as an argument and places its words in a list…
A: #method that takes sentence as argument and places its words#in a list in alphabetical order and…
Q: int x1 = 66; int y1 = 39; int d; _asm { } mov EAX, x1; mov EBX, y1; push EAX; push EBX; pop ECX mov…
A: Here we have given a code fragment in assembly language, our task is to find the value of d in…
Q: C# Question Write a statement that declares a variable words and initialize it to the following…
A: Here is the statement that declares a variable words and initialize it to the following list of…
Q: ROBLEM STATEMENT: Return the longest String! CN YOU HELP ME WITH THIS JAVA CODE PROBLEM
A: Required: PROBLEM STATEMENT: Return the longest String!
Q: int numArray[] = {50, 60, 70, 8, 9}; int *ptr1 = &numArray[3]; int *ptr2 = &numArray[1]; Is the…
A: The correct option is true. Explanation: In function prototype we insure that whenever we want to…
Step by step
Solved in 3 steps
- JAVA CODE PLEASE FINAL EXAM Part 3 Instructions: Create a java program that asks & accepts input from the user (must be int value). Then depending on the number of inputs, the program will ask the user to enter string value/s. After, the program will print the strings entered by the user line-by-line. Constraints: Create a function and call it in the main function. Use Functions With No Parameters and Return Values Use for Loop Use String Array Use Scanner Input 1. One line containing an integer Sample 2 2. One line containing string Sample Funny 3. One line containing string Sample Sadly Output Enter·the·number·of·string·array:·2 Enter·string·#1:·Funny Enter·string·#2:·Sadly You've·entered: Funny SadlyAssignment #2 Instructions: Through this programming assignment, the students will learn to do the following: Learn to work with command line options and arguments Gain more experience with Makefiles Gain more experience with Unix Learn to use some of the available math funtions available with C Usage: mortgagepmt [-s] -r rate [-d downpayment] price In this assignment, you are asked to perform the mortgage payment calculation. All information needed for this will be passed to the program on the command line. There will be no user input during the execution of the program You will need a few pieces of information. The price of the home and the amount of the down payment. You will also need to know the interest rate and the term of the mortgage. To figure your mortgage payment, start by converting your annual interest rate to a monthly interest rate by dividing by 12. Next, add 1 to the monthly rate. Third, multiply the number of years in the term of the mortgage by 12 to calculate…Instruction: It should be a C++ PROGRAM INCLUDE THE HEADER FILE, MAIN CPP, AND BSTREE.CPP There is a real program developed by a computer company that reads a report ( running text ) and issues warnings on style and partially corrects bad style. You are to write a simplified version of this program with the following features: Statistics A statistical summary with the following information: Total number of words in the report Number of unique words Number of unique words of more than three letters Average word length Average sentence length An index (alphabetical listing) of all the unique words (see next page for a specific format) Style Warnings Issue a warning in the following cases: Word used too often: list each unique word of more than three letters if its usage is more than 5% of the total number of words of more than three letters Sentence length : write a warning message if the average sentence length is greater than 10 Word length : write a warning message if the…
- hi can you explain these functions to me def encode(message):encode_dict = {'A': '.-', 'B': '-...', 'C': '-.-.','D': '-..', 'E': '.', 'F': '..-.','G': '--.', 'H': '....', 'I': '..','J': '.---', 'K': '-.-', 'L': '.-..','M': '--', 'N': '-.', 'O': '---','P': '.--.', 'Q': '--.-', 'R': '.-.','S': '...', 'T': '-', 'U': '..-','V': '...-', 'W': '.--', 'X': '-..-','Y': '-.--', 'Z': '--..', ' ': '.....'}encoded = ' '.join(encode_dict[i] for i in message.upper())return encodeddef decode(message):encode_dict = {'A': '.-', 'B': '-...', 'C': '-.-.','D': '-..', 'E': '.', 'F': '..-.','G': '--.', 'H': '....', 'I': '..','J': '.---', 'K': '-.-', 'L': '.-..','M': '--', 'N': '-.', 'O': '---','P': '.--.', 'Q': '--.-', 'R': '.-.','S': '...', 'T': '-', 'U': '..-','V': '...-', 'W': '.--', 'X': '-..-','Y': '-.--', 'Z': '--..', ' ': '.....'}decode_dict = {v: k for k, v in encode_dict.items()}decoded = ''.join(decode_dict[i] for i in message.split())return decodeddef process_lines(filename, mode):with…c++ Question 3 Write a program to create student class, read and print N (at least 4 inputs) student’s details. Hint: Students details may be name, ID, Discipline, Year of study, age etc Full explain this question and text typing work only thanksplease code in python regular expression In some web forms, users must enter a phone number, and some of these aggravate users byaccepting only a specific format. You have been hired to write a program that reads U.S. phone numbers with the three-digit area and seven-digit local codes accepted as ten digits, or separated into blocks using hyphens or spaces, and with the area code optionally enclosed in parentheses. For example, all of these are valid: 555-123-1234, (555) 1234567, (555) 123 1234, and 5551234567. Read the phone numbers from user input and for each one echo the number in the form “(999) 999 9999” or report an error for any that are invalid, or that don’t have exactly ten digits.
- There are given code: # TODO: Import math module def quadratic_formula(a, b, c):# TODO: Compute the quadratic formula results in variables x1 and x2return (x1, x2) def print_number(number, prefix_str):if float(int(number)) == number:print("{}{:.0f}".format(prefix_str, number))else:print("{}{:.2f}".format(prefix_str, number)) if __name__ == "__main__":input_line = input()split_line = input_line.split(" ")a = float(split_line[0])b = float(split_line[1])c = float(split_line[2])solution = quadratic_formula(a, b, c)print("Solutions to {:.0f}x^2 + {:.0f}x + {:.0f} = 0".format(a, b, c))print_number(solution[0], "x1 = ")print_number(solution[1], "x2 = ")Python Returning function function name: is_prime parameters: a number n returns: True if n is prime behavior: Check the values in the range [2, n) and return False if n is divible by any of them. function name: bound_0_to_100 parameters:a number grade returns: the grade with a minimum of 0 and a maximum of 100 behavior: In addition to exceeding 100, sometimes a grade will be so spectacularly bad that it falls below 0. In that case we want to normalize it to 0 so all grades fall into the range [0, 100]. ex: bound_0_to_100(75) returns 75, bound_0_to_100(103) returns 100, and bound_0_to_100(-5) returns 0 function name: bigger parameters: two values a and b returns: whichever of the two is greatest behavior: ex: bigger(3, 9) returns 9IN C++ Write code that: creates 3 integer values - one can be set to 0, the other two should NOT multiples of one another (for example 3 and 6, or 2 and 8) take you largest value and perform a modulus operation using the smaller (non zero) value as the divisor print out the result. create an alias for the string type call the alias "name" then create an instance of the "name" class and assign it a value using an appropriate cout statement - print out the value Please screenshot your input and output, as the format tends to get messed up. Thank you!
- Q1: Code written using language A Code written using language B Line 1: x=3 Line 2: func1 ) { print "x"; } Line 3: func2 () { Line 4: int x=9; Line 4: func1; Line 5: x-4.5 } Line 4: func1 Line 5: func2 Line 1: x=3 Line 2: func1 0{ print "x"; } Line 3: func2 () { Line 4: int x3D%3B Line 4: func%; Line 5: x=4.5 } Line 4: func1 Line 5: func2 Line 6: func1 Line 6: func1 Output: Output: No compilation errors. Running: 3 Running: 3 3 Error x is int and assigned a float value 4.5 Compare between language A and language B in terms of being 1) compiled vs. interpreted 2) imperative vs. declarative 3) object-oriented vs. non-object-oriented 4) weakly typed vs strongly typed 5) statically scoped vs. dynamically scoped [12 pt]Microsoft and Sun have had multiple open conversations over the architecture of Microsoft's J++ and C# and Sun's Java. These topics have been raised in open discourse. Some of these papers may be found on their own websites; you should read a few and then analyze the implications of the discrepancies for the delegates in writing.Х3: inlTol0 Write a function in Java that implements the following logic: Given a number n, return true if n is in the range 1..10, inclusive. Unless "outsideMode" is true, in which case return true if the number is less or equal to 1, or greater or equal to 10. Your Answer: 1 public boolean in1To10(int n, boolean outsideMode) 2 { 3 } H N M