Question
python
s1 = hi! s2 = exam Show a one line python expression that could construct each of the following results by performing str

0 0
Add a comment Improve this question Transcribed image text
Answer #1

An suer

i) s1.upper()
ii) s1+s2+s1
iii) (s1[0].upper() + s1[1:] + s2[0].upper() + s2[1:])*3
iv) s2.split("a")
v) ss2[:-1]
vi) s1[:-1]+"m"
vii) s2[::-1]
Add a comment
Know the answer?
Add Answer to:
python s1 = "hi!" s2 = "exam" Show a one line python expression that could construct...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • python Show the output generated in python for the following cases: s1 "Mueller" s2- "Collusion" i)...

    python Show the output generated in python for the following cases: s1 "Mueller" s2- "Collusion" i) print( The winner is: "+ s2+'or" +s1) i) print( ( s1+ s2) * 2) ili) print(s11.3]) v) print(s112]+ s2 2]) v) print(s1[-1]+ s21-1]) vi) print(s2 upper) vii)for w in "Mississippi" split( ss) print( w end

  • Write the function in python and show the code 2. Write a function jscore (s1, s2)...

    Write the function in python and show the code 2. Write a function jscore (s1, s2) that takes two strings s1 and s2 as inputs and returns the Jotto score of s1 compared with s2 -.e., the number of characters in s1 that are shared by s2. The positions and the order of the shared characters within each string do not matter. Repeated letters are counted multiple times, as long as they appear multiple times in both strings. For example...

  • Lab 4: Java Fundamentals, Part IV In this assignment, you solve a conversion problem similar to...

    Lab 4: Java Fundamentals, Part IV In this assignment, you solve a conversion problem similar to Programming Challenge 1 of Chapter 3 of your text, page 184 (187 in Edition 5). Given one of the Roman numerals I, II, III, IV, V, VI, VII, VIII, IX, X, XI, XII, XIII, XIV, XV as an input your program must determine and display the corresponding decimal digit 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15....

  • it is about the classical logic in the subject of formal method: the question is shown...

    it is about the classical logic in the subject of formal method: the question is shown as the picture Question 1: Classical Logic [25 marks) a) Answer the following questions briefly but precisely. i. State what it means for an argument to be valid in Predicate Logic. [3 marks ii. Suppose you use resolution to prove that KB = a. Does this mean that a is valid? And why? [3 marks b) Consider the following three English sentences: Sl: If...

  • Preliminaries For this lab you will be working with regular expressions in Python. Various functions for...

    Preliminaries For this lab you will be working with regular expressions in Python. Various functions for working with regular expressions are available in the re module. Fortunately, Python makes it pretty easy to check if a string matches a particular pattern. At the top of the file we must import the re module: import re Then we can use the search() function to test whether a string matches a pattern. In the example below, the regular expression has been saved...

  • Part (V) to (Vii) A large number of people worldwide take the GMAT exam each year...

    Part (V) to (Vii) A large number of people worldwide take the GMAT exam each year as they apply for MBA programs. Administrators of the test suggest that from past experience the distribution of GMAT exam scores is closely approximated by a normal distribution with mean 1F525 and standard deviation ơ-100 (i)Assuming the population distribution of GMAT exam scores is normal, what is the probability that a person randomly drawn from those taking the test would have a test score...

  • Hi could you help me with this problem please? The following spectroscopic data were obtained for...

    Hi could you help me with this problem please? The following spectroscopic data were obtained for an organic compound: i. MS (relative abundance in parentheses): M+ = 86 ; signals at 29 (92) and 41 (100) among others ii. IR (cm-1): 3100 (weak sharp), 2970 (medium sharp), 2850 (medium), 1650 (weak sharp), 1100 (strong sharp) iii. H1 NMR :     Signal A at 4 ppm (3H, triplet),     Signal B at 3.53 ppm (2H quartet),     Signal C at 4.01...

  • A large number of people worldwide take the GMAT exam each year as they apply for...

    A large number of people worldwide take the GMAT exam each year as they apply for MBA programs. Administrators of the test suggest that from past experience the distribution of GMAT exam scores is closely approximated by a normal distribution with mean 1F525 and standard deviation ơ-100 (i)Assuming the population distribution of GMAT exam scores is normal, what is the probability that a person randomly drawn from those taking the test would have a test score between 510 and 550?...

  • Could someone please help me write this in Python? If time allows, it you could include...

    Could someone please help me write this in Python? If time allows, it you could include comments for your logic that would be of great help. This problem involves writing a program to analyze historical win-loss data for a single season of Division I NCAA women's basketball teams and compute from this the win ratio for each team as well as the conference(s) with the highest average win ratio. Background Whether it's football, basketball, lacrosse, or any other number of...

  • Please answer at least iv, v, and vi Best Plastics produces a line of cell phone...

    Please answer at least iv, v, and vi Best Plastics produces a line of cell phone covers. Its best-selling cover is the Cobra model, a slim but very durable black plastic cover. The annual fixed cost for the Cobra model is $234,000. This fixed cost includes management time, advertising, and other costs. In addition, the variable cost, including labor and material costs, is $2 for each unit produced Best Plastics sells the Cobra for $3.50 per unit. The exact demand...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT