TIME NOW CALENDAR CONVERT LENGTH CONVERT TEMPERATURE DICTIONARIES, LISTS SCIENCE EDUCATION RELIGION WORK CALCULATOR CALCULATE LIFE

# Python 3 programming language, learn python, tutorial

ALL TOPICS

1. Draw a game board. After entering number, it is added or removed. If twice deleted - no effect, if twice added- no effect:

---   ---   ---
|  1  |  2  |  3  |
---   ---   ---
|  4  |  5  |  6  |
---   ---   ---
|  7  |  8  |  9  |
---   ---   ---

Exit - 0. Enter number to delete, (example d1). Enter number to add (example - a1):

Data format:
d1
a9

2. Draw a game board with dynamic width and height:
----   ----   ----
|  01  |  02  |  03  |
----   ----   ----
|  04  |  05  |  06  |
----   ----   ----
|  07  |  08  |  09  |
----   ----   ----

Enter width and height (min = 2x2, max 6x8):

Data format:
3,5
4,4

3. Draw a histogram. Program takes a list of integers and prints a histogram to the screen. It can be processor's load from  0 to 10 stars. Lenght of list can change. Third column is set, when PROC1 + PROC2 >=10. For example, list1 = [4, 9, 7] and list2= [5,2,1] should print the following:
PROC1       | PROC2     |
****        | *****     |
*********   | **        | x
*******     | *         |

4. Write a program that changes a sentennce of words into a list of integers, representing the lengths of the correponding words.
"Mano batai buvo du. Niekur eiti negaliu???" is converted to [4,4,4,2,6,4,7]. Calculate frequency of the words and sort: {2:1, 4:2, 6:1, 7:1}.

5. Write function, which generates HTML table from row "nafta - 50EUR, bendzinas - 100EUR, dujos - 60EUR, auksas - 110EUR". Values and amount of pairs can change. If value
is > 100, it is marked as HTML red, if values is < 30, it is marked as HTML green. Even and odd rows are colored differently:
 nafta 50 bendzinas 100 dujos 60 auksas 110

HTML:
<table border="1">
<tbody>
<tr>
<td style="background-color:#D3D3D3;"><span>nafta</span></td>
<td style="background-color:#D3D3D3;"><span>50</span></td>
</tr>
<tr>
<td>bendzinas</td>
<td>100</td>
</tr>
<tr>
<td style="background-color:#D3D3D3;">dujos</td>
<td style="background-color:#D3D3D3;">60</td>
</tr>
<tr>
<td>auksas</td>
<td><span style="color:#FF0000;">110</span></td>
</tr>
</tbody>
</table>

6. Write a function, which shows overlapping elements from two lists. Another function shows different elements from both lists.
list1 = [1,2,3,4,5]
list2 = [5,2,5,1,5,1]

def compare(*lists):

def overlap():
pass

def different():
pass

overlap()
different()

compare (list1, list2)

7. Write a function to solve a classic ancient Chinese puzzle:
We count 35 heads and 94 legs among the chickens and rabbits in a farm. How many rabbits and how many chickens do we have?

8. Write function. With a given list [12,24,35,24,88,120,155,88,120,155], write a program to print this list leaving all duplicate values with original order reserved.
ALL TOPICS

 Andrius:2.list = [4, 9, 7]for n, b in enumerate(list, 1): print(n,'*'* b)5.b1 = [1,2,3,4,5,9,11,15]b2 = [4,5,6,7,8]def intersect(a, b):    return list(set(a) & set(b))print (intersect(b1, b2))b1 = [1,2,3,4,5,9,11,15]b2 = [4,5,6,7,8]def diff(a, b):    xa = [i for i in set(a) if i not in b]    xb = [i for i in set(b) if i not in a]    return xa + xbprint (diff(b1, b2))2015-11-09 08:20:15
 Vitalij:<1>s=" "list=[s,s,s,s,s,s,s,s,s]n=0 #X ar Olp=0 #00 and x<10: if list[x-1]==s: list[x-1]="X" lp+=1 else: if player==2: prnt(n) while lp==0: if player==1: from random import randint x=randint(0,10) else: x=int(input("Kur bus jusu O? Nuo 1 iki 9: ")) if x>0 and x<10: if list[x-1]==s: list[x-1]="O" lp+=1 lp=0 n+=1 if main==0: main = win("X") if main==1: prnt(n) print("Laimejo X") if main==0: main = win("O") if main==1: prnt(n) print("Laimejo O") if main==0: eql=0 if cik(eql)==9: prnt(n) print("Laimetoju nera :C") main=1; <3>==========================================================list=['vilniaus','verslo','kolegija','vvk','python','programa','kodas']print(list)for x in range(len(list)): list[x]=len(list[x])print(list)2015-11-09 09:24:23