Advertisement
Pr3mRxj

ISA 383 In-Class Exercise 4

Mar 26th, 2023 (edited)
1,291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | Source Code | 0 0
  1. #ISA 383 Solution Manual
  2. #Made by Prem Rajendran
  3.  
  4. #Guess which movie these quotes are from ;)
  5.  
  6. #Q1
  7. print("I'm gonna make him an offer he can't refuse".partition('offer'))
  8. print('Leave the gun. Take the cannoli'.partition('gun'))
  9. print("It's not personal Sonny. It's strictly business".partition("It's"))
  10.  
  11. #Q2
  12. print('Look how they massacred my boy'.ljust(75,'-'))
  13. print('Revenge is a dish that tastes best when it is cold'.center(75,'-'))
  14. print('Never let anyone know what you are thinking.'.rjust(75,'-'))
  15.  
  16. #Q3
  17. string_variable='Welcome to Python'
  18. print(len(string_variable)) #1
  19. print(string_variable[:1]) #2
  20. print(string_variable[-1:]) #3
  21. print(string_variable[1:]) #4
  22. print(string_variable[4:10]) #5
  23. print(string_variable[2:]) #6
  24. print(string_variable[-4:]) #7
  25. print(string_variable[::2]) #8
  26. print(string_variable[::-1]) #9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement