Hi! This all should be super easy to anyone who knows what they are doing with s
ID: 3713775 • Letter: H
Question
Hi! This all should be super easy to anyone who knows what they are doing with sound and picture loops using JES! I ask that you help me only if you know how to use JES and are familiar with python! Thanks! #9-18
If you looked closely at loopWithLocation0 when you typed it into JES you may have noticed that we access characters in a string in a much more direct manner. We DO NOT do this by using a function. Instead, we simply type up the name of the variable, put a set of square brackets after it, and put the index number inside of the square brackets For example, to access the first character in a string called "name" we would type: >>>name"Arthur Dent" >print (name[]) Given that: Q13] Write the command that would give access to the fourth character in a string called "name" Q14] Write the command that would give access to the LAST character in the string called name as defined above. Q15] Write the command that would give access to the last character in a string called name where you weren't sure how long it was. (HINT: You can ask the computer how long a string is. We did it in Q3). Python not only lets you get access to individual characters, but it lets you get access to substrings (pieces of the string you are working with). Type in the following: >>>name"Zaphod Beeblebrox" >>>print (name [0:6]) [Q16] What was printed? >>print (name [4:10]) [Q17] What was printed? >>>print (name [13:17])Explanation / Answer
Solution:
Note: The first four subparts have been answered as per Chegg guidelines, please repost others.
13)
print(name[3])
14)
print(name[10])
15)
print(name[-1])
16)
Zaphod
17)
brox
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.