Download presentation
Presentation is loading. Please wait.
Published bySophia West Modified over 5 years ago
1
IST256 : Applications Programming for Information Systems
Strings
2
Agenda Connection Activity Teaching: Practice Activity Strings
String Library Practice Activity Sentiment Analyzer
3
Connect Activity Double-Stack Kahoot!:
Double the Kahoot… double the fun. Top 3 Get a Prize! Loops: Functions:
4
Recall: Strings Name = ‘Fudge’ Name[1] = ‘u’
Strings are index able sequences of characters. The characters inside the string are immutable. Example: Name = ‘Fudge’ Immutable means we can’t do this: Name[1] = ‘u’
5
String functions galore:
Built In String Functions: sequence-type-str These just work Name.upper() The Python String Library: You must import String before you can use them.
6
Watch Me Code Let’s explore built-in string functions:
upper, lower, title, capitalize Isupper, islower, isdigit find, replace split
7
Help me Code Write a python function to: HINT:
Return true if a string is a number eg. “34” “-34” “3.4” “-3.4” Return false otherwise HINT: Use replace, isdigit
8
Watch Me Code Let’s explore the string library Import string Remove punctuation from a string
9
Now You Code “Twitter Sentiment Analyzer 1.0”
User inputs a Tweet, program outputs a score: >0 means tweet was POSITIVE <0 means tweet was NEGATIVE 0 means tweet was NEUTRAL Create list of “positive” words; list of “negative” words. Add 1 for each positive word in the string, subtract 1 for each negative word. Use built in string functions to help you.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.