diff --git a/notebook/cviko1_1.html b/notebook/cviko1_1.html new file mode 100644 index 0000000..776bbf4 --- /dev/null +++ b/notebook/cviko1_1.html @@ -0,0 +1,13460 @@ +None + + + + +cviko1_1 + + + + + + + + + +
+
+
+
+
+
In [9]:
+
+
+
text = "Some not interesting text input"
+
+
+
+
+
+
+
+
In [10]:
+
+
+
words = text.split(" ")
+
+
+
+
+
+
+
+
In [11]:
+
+
+
words
+
+
+
+
+
+
+
+
Out[11]:
+
+
['Some', 'not', 'interesting', 'text', 'input']
+
+
+
+
+
+
+
+
In [12]:
+
+
+
for word in words:
+    print(word)
+
+
+
+
+
+
+
+
+
+
Some
+not
+interesting
+text
+input
+
+
+
+
+
+
+
+
+
In [13]:
+
+
+
"The lazy fox jumps over the lazy dog".split("the")
+
+
+
+
+
+
+
+
Out[13]:
+
+
['The lazy fox jumps over ', ' lazy dog']
+
+
+
+
+
+
+
+
In [14]:
+
+
+
len("Hello")
+
+
+
+
+
+
+
+
Out[14]:
+
+
5
+
+
+
+
+
+
+
+
In [15]:
+
+
+
len(words)
+
+
+
+
+
+
+
+
Out[15]:
+
+
5
+
+
+
+
+
+
+
+
In [16]:
+
+
+
len(words[0])
+
+
+
+
+
+
+
+
Out[16]:
+
+
4
+
+
+
+
+
+
+
+
In [18]:
+
+
+
"text" in words
+
+
+
+
+
+
+
+
Out[18]:
+
+
True
+
+
+
+
+
+
+
+
In [19]:
+
+
+
text.count("text")
+
+
+
+
+
+
+
+
Out[19]:
+
+
1
+
+
+
+
+
+
+
+
In [20]:
+
+
+
long_words = [word for word in words if len(word) > 4]
+
+
+
+
+
+
+
+
In [21]:
+
+
+
long_words
+
+
+
+
+
+
+
+
Out[21]:
+
+
['interesting', 'input']
+
+
+
+
+
+
+
+
In [22]:
+
+
+
"Hello".title()
+
+
+
+
+
+
+
+
Out[22]:
+
+
'Hello'
+
+
+
+
+
+
+
+
In [23]:
+
+
+
capitals = [word for word in words if word.istitle()]
+
+
+
+
+
+
+
+
In [24]:
+
+
+
capitals
+
+
+
+
+
+
+
+
Out[24]:
+
+
['Some']
+
+
+
+
+
+
+
+
In [25]:
+
+
+
"Adam".upper()
+
+
+
+
+
+
+
+
Out[25]:
+
+
'ADAM'
+
+
+
+
+
+
+
+
In [26]:
+
+
+
"Adam".lower()
+
+
+
+
+
+
+
+
Out[26]:
+
+
'adam'
+
+
+
+
+
+
+
+
In [31]:
+
+
+
text = "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s , when an unknown printer took a galley of type and scrambled it to make a type specimen book ."
+
+
+
+
+
+
+
+
In [33]:
+
+
+
len(set(text.split(" ")))
+
+
+
+
+
+
+
+
Out[33]:
+
+
30
+
+
+
+
+
+
+
+
In [ ]:
+
+
+
 
+
+
+
+
+
+
+
+
+ + diff --git a/notebook/cviko1_2-chatbot.html b/notebook/cviko1_2-chatbot.html new file mode 100644 index 0000000..43c4626 --- /dev/null +++ b/notebook/cviko1_2-chatbot.html @@ -0,0 +1,13175 @@ +None + + + + +cviko1_2-chatbot + + + + + + + + + +
+
+
+
+
+
In [10]:
+
+
+
import random
+
+no_responses = [
+    "I can't answer that.",
+    "I don't know, sorry.",
+    "I can't understand you.",
+    "Can you elaborate, please?"
+]
+
+responses = {
+    "What's the weather like today?": [
+        "It's sunny!",
+        "It seems sunny today.",
+        "Sunny."
+    ],
+    "What is your name?": [
+        "My name is AI-CHATBOT.",
+        "It's AI-CHATBOT.",
+    ],
+    "What's your favorite color?": [
+        "It's yellow.",
+        "Yellow."
+    ],
+    "What color is the sky?": [
+        "The sky is blue.",
+        "It's blue."
+    ],
+    "Can you talk?": [
+        "No.",
+        "Nope.",
+        "I can't do that."
+    ]
+}
+
+while True:
+    message = input("> ")
+
+    if message == "bye":
+        print("< Bye")
+        break
+    
+    if message in responses.keys():
+        print("<", random.choice(responses[message]))
+    else:
+        print("<", random.choice(no_responses))
+
+
+
+
+
+
+
+
+
+
< My name is AI-CHATBOT.
+< I can't do that.
+< Nope.
+< The sky is blue.
+< Bye
+
+
+
+
+
+
+
+
+
In [ ]:
+
+
+
 
+
+
+
+
+
+
+
+
+ + diff --git a/requirements.txt b/requirements.txt index 3ce71f0..3ed96ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,31 @@ asttokens==3.0.0 +attrs==25.1.0 +beautifulsoup4==4.13.3 +bleach==6.2.0 comm==0.2.2 debugpy==1.8.12 decorator==5.1.1 +defusedxml==0.7.1 executing==2.2.0 +fastjsonschema==2.21.1 ipykernel==6.29.5 ipython==8.32.0 jedi==0.19.2 +Jinja2==3.1.5 +jsonschema==4.23.0 +jsonschema-specifications==2024.10.1 jupyter_client==8.6.3 jupyter_core==5.7.2 +jupyterlab_pygments==0.3.0 +MarkupSafe==3.0.2 matplotlib-inline==0.1.7 +mistune==3.1.2 +nbclient==0.10.2 +nbconvert==7.16.6 +nbformat==5.10.4 nest-asyncio==1.6.0 packaging==24.2 +pandocfilters==1.5.1 parso==0.8.4 pexpect==4.9.0 platformdirs==4.3.6 @@ -21,8 +36,14 @@ pure_eval==0.2.3 Pygments==2.19.1 python-dateutil==2.9.0.post0 pyzmq==26.2.1 +referencing==0.36.2 +rpds-py==0.22.3 six==1.17.0 +soupsieve==2.6 stack-data==0.6.3 +tinycss2==1.4.0 tornado==6.4.2 traitlets==5.14.3 +typing_extensions==4.12.2 wcwidth==0.2.13 +webencodings==0.5.1