
    

    <?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://ocw.cs.pub.ro/courses/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="http://ocw.cs.pub.ro/courses/feed.php">
        <title>CS Open CourseWare ii:labs:s2:01:tasks</title>
        <description></description>
        <link>http://ocw.cs.pub.ro/courses/</link>
        <image rdf:resource="http://ocw.cs.pub.ro/courses/lib/tpl/arctic/images/favicon.ico" />
       <dc:date>2026-06-05T09:32:18+03:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/01?rev=1710502217&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/02?rev=1710502224&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/03?rev=1710502233&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/04?rev=1710502212&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/05?rev=1710502252&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="http://ocw.cs.pub.ro/courses/lib/tpl/arctic/images/favicon.ico">
        <title>CS Open CourseWare</title>
        <link>http://ocw.cs.pub.ro/courses/</link>
        <url>http://ocw.cs.pub.ro/courses/lib/tpl/arctic/images/favicon.ico</url>
    </image>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/01?rev=1710502217&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-15T13:30:17+03:00</dc:date>
        <title>01. [25p] String manipulation</title>
        <link>http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/01?rev=1710502217&amp;do=diff</link>
        <description>01. [25p] String manipulation

First, let's familiarize ourselves with Python's string type:

	*  Read a string input from the user's console (hint: input()); next sub-tasks will use this value and apply various string transformations on it;
	*  Print the reversed string (e.g., “hello world” =&gt; “dlrow olleh”); hint: there are at least 3 built-in ways to do this in a single line of code ;)
	*  Print the same string in “aLtErNaTe CaSe” (if you're out of ideas, simply use the for loop);
	*  Finally…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/02?rev=1710502224&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-15T13:30:24+03:00</dc:date>
        <title>02. [25p] Let's do the math!</title>
        <link>http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/02?rev=1710502224&amp;do=diff</link>
        <description>02. [25p] Let's do the math!

Python is also popular for its numeric manipulation features (it can handle very large numbers!).
Let's find out:

	*  Read a number from the console (you should know how to do it by now; don't forget to convert it to an int!);
	*  Reverse the number's digits and print the result (e.g., 13568 =&gt; 86531)!
	*  Define a new function, generate_prime(k), which takes in an argument and will generate a prime number of exactly k digits; use it to generate a 15-digit prime nu…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/03?rev=1710502233&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-15T13:30:33+03:00</dc:date>
        <title>03. [25p] Making the list</title>
        <link>http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/03?rev=1710502233&amp;do=diff</link>
        <description>03. [25p] Making the list

Solve these subtasks all in the same file (use print() statements to display the results):

Use the following list: 


sample = [&quot;a&quot;, 90, 8, &quot;X55&quot;, &quot;1z&quot;, 102, &quot;asdf&quot;, 65, 10, &quot;word&quot;, &quot;567&quot;, 567]


Well:

	*  Sort the list (does it work? if not, why?);
	*  Reverse the list (this again? note: save the original one!);
	*  Filter out all non-numbers from the list (i.e., only int type values should remain)... can you make it using a single line of code? now it's the time to…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/04?rev=1710502212&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-15T13:30:12+03:00</dc:date>
        <title>04. [25p] Word Map</title>
        <link>http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/04?rev=1710502212&amp;do=diff</link>
        <description>04. [25p] Word Map

First, take a couple (3-4) of paragraphs from here and store them inside a .txt file.

	*  Open the file and read its contents into string;
	*  Build a dict with each word from this text (lower cased as key), counting their frequency (as its value);
	*  Use it to print out the most frequent 5 words in this text (together with their value!), e.g.:</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/05?rev=1710502252&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-03-15T13:30:52+03:00</dc:date>
        <title>05. [10p] Bonus: Lyrics retrieval</title>
        <link>http://ocw.cs.pub.ro/courses/ii/labs/s2/01/tasks/05?rev=1710502252&amp;do=diff</link>
        <description>05. [10p] Bonus: Lyrics retrieval

What else can you do easily using Python... ?

Let's try this one: 

	*  fetch the lyrics of your favorite song from this site.


requests
pip


	*  Extract just the lyrics part from the HTML code and print it to the console! (also, please get rid of those &lt;br&gt; line break tags, replace them with newlines instead).</description>
    </item>
</rdf:RDF>
