1. Type the expressions below in python interactively, and try to explain what's happening in each case: a. 2** 16 2/5, 2/5.0 b. "spam" + "eggs" S = "ham" "eggs " +S S*5 S[:0] "green %s and %s" % ("eggs", S) c. ('x',) [0] (x, У) [1] d. L= [1,2,3] + [4,5,6] L, L[:], L[:0], L[-2], L[-2:] ([1,2,3] + [4,5,6]) [2:4] [L[2], L[3]] L.reverse(); L L.sort(); L L.index(4)
Q: AL= 53 CL=29 ADD AL, CL DAA What is the value of AL after execution? A) 39 B) None C) 7CH D) 35H
A: The question is on what is the value of AL after execution.
Q: elect the correct answer 5. Identify the line that has dead code. Dead code refers to code which…
A: Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.…
Q: What does the following Python program print? x = 9 + 6 /3 * 2 1 print(x)
A: Based on python
Q: Question 41 What is the output of the following Python code? x [24, 4] smallest =min(x) while…
A: smallest = 4 s=0 While Loop 1: TRUE (4>=1) if condition TRUE (24%4=0 and 4%4=0) s=0+4=4…
Q: From time to time Yetis who live high up in the Himalayan mountain ranges come down from the…
A: Step 1 : Start Step 2 : Define a function isValidYeti() which takes the code as argument and return…
Q: finishcode to say 'Remainder: 0.0' as output.…
A: Task : Given the python. The task is to correct the above function and produce the desired output.
Q: John Cena has bought some gifts for roman reigns, undertaker, Stephanie macmohan and his other…
A: Given:
Q: A commercial bank has introduced an incentive policy of giving a bonus to all its deposit holders by…
A: 1) Below is commercial bank incentive policy program to calculate the bonus based on balance amount…
Q: Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when…
A: Program Instructions:The sum is used to calculate the sum of the list.The check variable is used to…
Q: The volume of a sphere of radius 1 inside a cube of side 2 is V= 4π/3. Write a fortran program t
A: Actually, program is a executable software that runs on a computer.
Q: Create a python program that would perform the given description below Your task is to write a…
A: Start Declare required variables. Draw board, using function. Function to check the position is…
Q: 1. What is printed by the Python code? def func(x): return x-1 print(func(3) *…
A: NOTE:“Since you have asked multiple questions, we will solve the first question for you. If you want…
Q: Assume x is equal to 4, In which of the following that y is not equal to 5 after execution? اختر…
A: Program execution in CPU A sequence of instructions is stored in memory.
Q: write a program c ++ Find the value of B (true or false) for the following : i= 5:j = 9 B= ! (( i>…
A: Boolean operator in C: In C++ three categories of Boolean operators are used: "&&" used for…
Q: PYTHON!!!!! Use the strategy of the decimal to binary conversion implemented in Project 4, and the…
A: Note: Below is the required program in python. Programming Approach: Read the message. Take an…
Q: What will be the output of the following Python code? i = 2 while True: if i%3 == 0:…
A: In step 2, you will get the output.
Q: Select the correct answer 3. What will be the value of x after the following is executed? def…
A: def funcThatReturnsBool(): return 2 > 1 x = funcThatReturnsBool() print(x) output is…
Q: write a PYTHON program for An online music and apps store offers all apps for 3$ each and all songs…
A: Program for the above describe condition: app = 3 song = 7 prepay = int(input('How much money do you…
Q: What would the following code output in Python? def add(x,y): x+y add(1,2) A) "3" B) It won't…
A: We have to provide the output of given code snippet
Q: A palindrome is a number or text phrase that reads the same backwards or forwards. For example, each…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: 10. I Love CCS by Jemar Jude Maranga Write a program that will take as input an integer n, and will…
A: We will use Java programming language for this question Algorithm: Ask user to input an integer…
Q: QUESTION 2 What will be the output of the following Python code? A. error B. a b c d…
A: Python code to convert lower case to upper case
Q: 3 QI: Write a python program to accept two numbers a and b, then print the following: o ifa is equal…
A: Note: we are only allowed to solve one question in one post. to get answers to others, please post…
Q: Consider the following Python code: def multiply_numbers(x, y): z = x * y return z w =…
A: Function returns the value z
Q: Write a computer program in Fortran 90 to find sum of mod and divide two integers numbers, and then…
A: 1- In this assignment require to take the two integer number from the user and calculate the mod,…
Q: Write a Python program with the statements that computes and reports the results of each of the…
A: x = 2y = -3w = 7z = -10 print("a.", (x/y))print("b.", (w/y/x))print("c.", (z/y%x))print("d.",…
Q: Suppose the following expressions are used to calculate the values of L for different values of S: L…
A: I have given python code in step2
Q: What will be the output of the following Python code? i = 1 while True: if i%3 == 0:…
A: i = 1 while True: if i%3 == 0: break print(i) i =i+ 1
Q: Identify the errors in the following pieces of code and rewrite the code after removing them. DEF…
A: GIVEN : Identify the errors in the following pieces of code and rewrite the code after…
Q: A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number…
A:
Q: What will be the output of the following Python code? i = 0 while i < 5: print(i) i += 1…
A: Question. What will be the output of the following Python code? i = 0 while i < 5:…
Q: Create a Python program that will compute the average score of S quizzes. Below is a sample program…
A: #initializing sumsum=0#iterating to 5 timesfor x in range(5): #taking input from user and…
Q: Write a program in python that reads in three numbers from the keyboard and then uses only…
A: Input : First number, second number and third number Output : Printing numbers in the increasing…
Q: 1. Write a Python program to print the following string in a specific format (see the output).…
A: print("Twinkle, twinkle, little star,\nHow I wonder what you are!\nUp above the world so high,\nLike…
Q: Type the expressions below in python interactively, and try to explain what's happening in each…
A: a. 2**162 / 5, 2 / 5.0 In the first line ** represents the power operator. It is used to calculate…
Q: What is the output of the following python code? a True b = False = False C %3D if not a or b: print…
A:
Q: def notRelPrime(a,b): for i in range(2,a+1): if(a%i==0 and b%i==0): return True; return False; x =…
A: EOFError When one of the built-in functions input() or raw input() encounters an end-of-file (EOF)…
Q: a. Rewrite the following expressions in java code: "In| i. m = i. x = logha where x and y are real…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: 12. Write a JAVA program to print the sum of odd natural numbers in the range [n1,n2] where n1, n2…
A: Write a JAVA program to print the sum of odd natural numbers in the range [n1,n2] where n1, n2 are…
Q: Write boolean expressions that correspond to the following english statements: a. The type of a…
A: Python codes:- a):- # Multiplying float variable with int variable mul = 2.3 * 5 # Boolean…
Q: Write a program that repeatedly reads in integers until a negative integer is read. The program also…
A: start create empty list input number append a into list l.append(a) run loop until…
Q: Fitness Quotient Minimum Heart Rate Maximum Heart Rate Heart Rate Series 0.919 68 80 68, 69, 76, 78,…
A: Solution is provided step by step in the java language- Following is the code written in java for…
Q: What error will Python display when it attempts to execute the following if/else statement? if a ==…
A: According to the given code of python, After executing this it will indicate an error. There are a…
Q: Given word=‘Python’ , what is printed by print(word[-1])? A. n B. o C. on D. ython
A: According to the Question below the Solution:
Q: Write a program that extracts from a text all dates written in format DD.MM.YYYY and prints them on…
A: re is the module in python to implement functions related to regular expressions findAll function…
Q: PYTHON Write a program which prompts the user for a distance in Kilometers, the program should…
A: Here, we are going to write a Python program which will take distance in kilometers from user and…
Q: Suppose that 1 and y are of type int, z is of type double, and ch is of type char. Consider the…
A: Coded using C++.
Q: (Python) I've already printed these out and have the answers. I needed some help explaining exactly…
A: The string is a collection of alphabets, words, or other characters. It is one of the primitive data…
Q: Write python programs to solve below problems in Jupyter note book, Then downle the programs as…
A:
Step by step
Solved in 5 steps with 1 images
- Use C Language Write a program that reads two matrices of integers. It then generates the sum and difference of the two matrices. The sum of the two matrices of the same size is a matrix with elements that are the sums of the corresponding elements of the two given matrices. Addition is not defined for matrices of different sizes. If A and B are matrices of the same size, then we define subtraction as follows: A – B = A + (-B). Thus, to subtract matrix B from matrix A, we simply subtract corresponding elements.RESTRICTIONS, PLEASE READ:Do it on python and do not add any imports.Do not use try-except statements. def find_email(s: str) -> str: """ Given a string <s>, return the email that exists in the string. Preconditions: <s> contains at most 1 email, or none at all. If <s> does not contain an email, return the empty string. Email definition: An email address is defined as 'name@domain.com' or 'name@domain.ca' with the following specifications: name: the name is an alphanumeric string that is less than or equal to 12 characters. Additional characters allowed are dash (-), period (.) and underscore (_). But the email cannot start or end with these additional characters. The name must also be at least 1 character long. Example names: a ab a_b…code in java pls Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is: 130 50 130 the output is: 80 0 80 Find the smallest value, and then subtract it from all three values, thus removing the gray.
- In python, Problem Description:Sheldon and Leonard are physicists who are fixated on the BIG BANG theory. In order to exchange secret insights they have devised a code that encodes UPPERCASE words by shifting their letters forward. Shifting a letter by S positions means to go forward S letters in the alphabet. For example, shifting B by S = 3 positions gives E. However, sometimes this makes us go past Z, the last letter of the alphabet. Whenever this happens we wrap around, treating A as the letter that follows Z. For example, shifting Z by S = 2 positions gives B. Sheldon and Leonard’s code depends on a parameter K and also varies depending on the position of each letter in the word. For the letter at position P, they use the shift value of S = 3P + K. For example, here is how ZOOM is encoded when K = 3. The first letter Z has a shift valueof S = 3 × 1 + 3 = 6; it wraps around and becomes the letter F. The second letter, O, hasS = 3 × 2 + 3 = 9 and becomes X. The last two letters…Submit in python or c++. Error code will downvoted. Every cell (x,y) contains an integer ax,y signifying the course of how the ball will move. ax,y=1 — the ball will move to one side (the following cell is (x,y+1)); ax,y=2 — the ball will move to the base (the following cell is (x+1,y)); ax,y=3 — the ball will move to one side (the following cell is (x,y−1)). Each time a ball leaves a cell (x,y), the integer ax,y will change to 2. Mr. Chanek will drop k balls successively, each beginning from the primary line, and on the c1,c2,… ,ck-th (1≤ci≤m) sections. Decide in which segment each ball will wind up in (position of the ball in the wake of leaving the network). Input :The principal line contains three integers n, m, and k (1≤n,m≤1000, 1≤k≤105) — the size of the framework and the number of balls dropped by Mr. Chanek. The I-th of the following n lines contains m integers ai,1,ai,2,… ,ai,m (1≤ai,j≤3). It will fulfill ai,1≠3 and ai,m≠1. The following line contains k integers c1,c2,……Please solve this in C programming language as early as possible. Suppose, you are trying to encrypt a string for security purpose. Write a program that can take a string from the user and then create a function that can replace all the vowels to its immediate next letters. Print the modified string. Don't use any Library function. Use this function: void str_modify(char *p); (6) Example: Input string: i love Bangladesh. Modified string: j lpvf Bbnglbdfsh
- Please explain Python Code def convertup(word):uppercaseword = ""#for c in word:for lc in range(len(word)):c = word[lc].upper() uppercaseword += creturn uppercaseworddef wconvertup(word):uppercaseword = ""lc = 0while (lc < len(word)):c = word[lc].upper() uppercaseword += clc += 1return uppercaseworddef inplaceconvertup(word):for lc in range(len(word)):# strings are immutable !!# so I can't say word[lc] = word[lc].upper()word = word[:lc] + word[lc].upper() + word[lc+1:]return word# might substitute a careful use of chr(ord("a")-32) for .upper()def recursivetoupper(word,spot):if spot < len(word): # keep goingword = word[:spot] + word[spot].upper() + word[spot+1:]return recursivetoupper(word,spot+1)return worddef rconvertup(word):return recursivetoupper(word,0)CODE IN PYTHON Colouring Book Having spent the last couple of hours grading assignments, I decide it’s time for a break. I take out my favourite colouring book, turn to a random page I haven’t coloured in yet, and lay it on my desk. I then take out all my n crayons and line them up on the desk (it’s a very long desk). The colour of the ith crayon is a string c[i] (e.g. "blue"). Many of the crayons have the same colour. In fact, no matter how many crayons I have, there are at most 30 distinct colours amongst them. To start colouring, I always take a sublist (see Q1 for a definition) of the crayons laid on the desk and put away the rest (too many options can be overwhelming and can lead to indecision). I take a look at the line art in front of me and wonder, “How many different colours do I need to make this look great? One? Two? Maybe three?”. Now you understand my dilemma and are fully aware of my indecision. You kindly decide to help me out by telling me for every number k, if I were…A palindrome is a string that reads the same forwards or backwards; for example dad, mom, deed are palindromes (i.e., reversing a palindrome produces the same string). Use C++ Programing language Write a recursive, boolean-valued function, isPalindrome that takes a string as a parameter and returns whether the string is a palindrome. A string, s, is a palindrome if: s is the empty string or s consists of a single letter (which reads the same back or forward), or the first and last characters of s are the same, and the rest of the string (i.e., the second through next-to-last characters) form a palindrome. Write a test program that reads a string from the standard input device and outputs whether the input string is a palindrome or not.
- Pleaseuse python to write function which convert numbers to letters. For ex: #1->a #2->b #26->z #27->aa # 28->ab #52->az #53->ba #54->bbNLP Q#2: Write regular expressions for the following languages. By "word", we mean an alphabetic string separated from other words by whitespace, any relevant punctuation, line breaks, and so forth. 1. the set of all strings with two consecutive repeated words (e.g., "Humbert Humbert" and "the the" but not "the bug" or "the big bug"); 2. all strings that start at the beginning of the line with an integer and that end at the end of the line with a word; 3. all strings that have both the word grotto and the word raven in them (but not, e.g., words like grottos that merely contain the word grotto); 4. Demonstrate a pattern to check if the email address is valid. 5. Demonstrate a pattern to verify the validity of a phone number, and check if it belongs to the Pakistani Mobile Network. 6. Demonstrate a RE to remove symbols and non-alphanumeric characters from the string paragraph. 7. Demonstrate a RE to remove URLs and HTML tags from the text string.Python: Implement a program that contains the following two functions:1. A function that accepts a list of numbers as an argument, the function should recursively calculate the sum of all the numbers in the list and returns that value2. A function that uses recursion to raise a number to a power. The function should accept two arguments: the number to be raised, and the exponent. Assume the exponent is a positive integer.