Scientific Computing
activity14.py and save it to your cs100/ch3 folder.myCourse = "CS100 Scientific Computing". For the following questions, write code to check your answer, and write your answer in comments next to it.
myCourse?print( myCourse[-9:-5])print( myCourse[17:21])print( myCourse[17] )?'S' in myCourse, and what command do you use to find it?print('100' in myCourse)?print('130' not in myCourse)?print('wow'*5)?print( ('.'*3 + 'y')*3 )?myCourse with "Exam 1".myCourse string so that it is center justified and takes up 40 characters of space. Hint: use the center function.f.
f to print out the last 5 characters of f.f to print out the substring ātasticā.s = input('Type something here: ') # <-- do not change this part
print(s)
s to print only the first 5 characters from the string the user typed in.s using the len function.book and assign it the string you copied. Itās a very long string, so we will use notation to start and end a multiline string ("""). For example:
book = """
put all pasted text here
....
it will span many lines
all of this is still a string
"""
book to answer the following questions. Print your results.
countACGT(seq) that displays the number of a, c, g, and t characters that occur in a DNA sequence. Call your function to test it with the string āaactTtgttActā. For example, calling the function countACGT('aactTtgttAct') should display:
No. of A: 3
No. of C: 2
No. of G: 1
No. of T: 6
Other letters: 0
Submit your working activity14.py to Moodle.