Question

plz answer these short ans in python language Q1- Write an expression whose value is the...

plz answer these short ans in python language

Q1- Write an expression whose value is the str that consists of the second through fifth characters of the str associated with s.

Q2-Given that s refers to a string, write an expression that evaluates to a string that is a substring of s and that consists of all the characters of s from its start through its ninth character.

Q3- Assume that word is a variable of type String that has been assigned a value. Write an expression whose value is a String consisting of the first three characters of the value of word. So if the value of word were "dystopia" the expression's value would be "dys".

Q4-Given three String variables that have been given values, firstName, middleName, and lastName, write an expression whose value is the initials of the three names: the first letter of each, joined together. So if firstName, middleName, and lastName, had the values "John", "Fitzgerald", and "Kennedy", the expression's value would be JFK". Alternatively, if firstName, middleName, and lastName, had the values "Franklin", "Delano", and "Roosevelt", the expression's value would be "FDR".

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

Answer Q1:

#prints chars from 2-5

print(s[2:5])

Answer Q2:

#prints chars from starting to till 9th char

print(s[0:9]);

Answer Q3:

#prints first 3 chars

print(s[0:3])

Answer Q4:

#appends first char of 3 variables

name=firstName[0]+middleName[0]+lastName[0]

Add a comment
Know the answer?
Add Answer to:
plz answer these short ans in python language Q1- Write an expression whose value is the...
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
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