Please use python to explain.
Assume that the variables x and y refer to strings. Write a code segment that prints these strings in alphabetical order. You should assume that they are not equal.
Assume that the variables x and y refer to strings.
code segment that prints these strings in alphabetical order. You should assume that they are not equal.
if(x < y):
print(x,y)
else:
print(y,x)

Please use python to explain. Assume that the variables x and y refer to strings. Write...
Using Python The variables x and y refer to numbers. Write a code segment that prompts the user for an arithmetic operator and prints the value obtained by applying that operator to x and y. Using the following information run an example in Python Idle op = input("Enter an arithmetic operator: ") if op == "+": print(x + y) elif op == "-": print(x – y) elif op == "*": print(x * y) elif op == "/":...
Python: We defined two variables, x = 'Python' and y = '3.0'. Write code to concatenate the two numbers (the result should be 'Python3.0').
Lab2: Processing Strings Part#1 – Counting Vows Assume s is a string of lower case characters. Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print: Number of vowels: 5 Part#2 – Counting Bobs Assume s is a string of lower case characters. Write a program that prints the number of times the string 'bob' occurs...
Do in Python
Problem 2 Assume s is a string of lower case characters. Write a program that prints the number of times the string ' lol' occurs in s For example, if s= 'azclololegghakl', then your program should print S Number of times lol occu rs is: 2 Problem 3 Assume s is a string of lower case characters Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example,...
Write a Python Program What should the values of X and Y be, so that the following code prints the 'd' found inside one of the elements of alist? alist = [['47a','47b'],'47c','47d',[['47e','47f'],'47g']] print(alist[X][Y]) Then write another print(...) statement that prints the the 'b' inside of alist, by indexing again into to its specific location within alist.
In python please. Write a program that reads whitespace delimited strings (words) and an integer (freq). Then, the program outputs the strings from words that have a frequency equal to freq in a case insensitive manner. Your specific task is to write a function wordsOfFreqency(words, freq), which will return a list of strings (in the order in which they appear in the original list) that have a frequency same as the function parameter freq. The parameter words to the function...
USE Python 1. Assign value 555 to the variable x, write code to square the variable x and print out the result. 2. Given a string x, write a program to check if its first character is the same as its last character. If yes, the code should output "True" . 3. We defined two variables, x = 'Python' and y = '3.0'. Write code to concatenate the two numbers (the result should be 'Python3.0').
For Python: (Use # comments to explain each line) Write code that prints an octagon shape using stars, by prompting the user for the octagon side length. For example: "How long should each side of the octagon be? " Then takes this input, and prints an octagon in stars using the user input.
Python code
Write a program that will ask the user to input two strings, assign the strings to variables m and n If the first or second string is less than 10 characters, the program must output a warning message that the string is too short The program must join the strings m and n with the join function The output must be displayed. Please name the program and provide at least one code comment (10)
Please use MatLab and comment code.
Problem 2 Write a MATI AB user-defined function y-M?SotxType): x is a vector containing numbers. and Type can be 'Ascending' or Descending'. This function should sort the given vector x in the ascending or descending order based on the user's request and return the desired vector as the output. Do not use MATLAB built-in function sort. Hint: When you call this function you need to use for Ascending or Descending since they are strings.