From 30c35eefe6cee55b8eb9868164c7a683599e88c0 Mon Sep 17 00:00:00 2001 From: swetha-create-tech Date: Sun, 26 Oct 2025 12:40:54 +0530 Subject: [PATCH 1/2] Add files via upload --- typeconversion.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 typeconversion.py diff --git a/typeconversion.py b/typeconversion.py new file mode 100644 index 00000000..2c6a96a3 --- /dev/null +++ b/typeconversion.py @@ -0,0 +1,18 @@ +# Sno 3 : "Type Conversion and validation examples: Implement a Python program to type conversion and validation examples" + +#conversion of tuple to list +tuple=(1,2,3,4,5) +list1=list(tuple) +print("conversion of tuple to list",list1) +#conversion of int to float +a=22 +print("conversion of int to float",float(a)) +#conversion of float to int +b=33.0 +print("conversion of float to int",int(b)) +#int to string conversion +c=7888 +print("int to string conversion",str(c)) +#string len to float +s="swe" +print("string to float",float(len(s))) \ No newline at end of file From 7837cd33c411cb4e6829b500eb869a2b3c02b4eb Mon Sep 17 00:00:00 2001 From: swetha-create-tech Date: Fri, 31 Oct 2025 10:54:26 +0530 Subject: [PATCH 2/2] Add files via upload --- SentimentAnalysis.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 SentimentAnalysis.py diff --git a/SentimentAnalysis.py b/SentimentAnalysis.py new file mode 100644 index 00000000..37bad917 --- /dev/null +++ b/SentimentAnalysis.py @@ -0,0 +1,23 @@ +# File: SentimentAnalysis.py +# Project: Sentiment Analysis using Pretrained Models + + +from transformers import pipeline + +def sentiment_analysis(text): + # Load pretrained model and tokenizer (DistilBERT) + sentiment_model = pipeline("sentiment-analysis") + + # Get prediction + result = sentiment_model(text)[0] + + # Print and return result + print(f"\n🧠 Input Text: {text}") + print(f"šŸ“Š Sentiment: {result['label']} (Confidence: {result['score']:.2f})") + + return result + +if __name__ == "__main__": + print("=== Sentiment Analysis using Pretrained Models ===") + user_input = input("Enter a sentence or paragraph: ") + sentiment_analysis(user_input)