Hometask 2 added
This commit is contained in:
parent
3a95b56b4b
commit
099deb9f5e
3 changed files with 166 additions and 1 deletions
12
.idea/material_theme_project_new.xml
generated
Normal file
12
.idea/material_theme_project_new.xml
generated
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MaterialThemeProjectNewConfig">
|
||||||
|
<option name="metadata">
|
||||||
|
<MTProjectMetadataState>
|
||||||
|
<option name="migrated" value="true" />
|
||||||
|
<option name="pristineConfig" value="false" />
|
||||||
|
<option name="userId" value="-1f8bf522:193639d1173:-7ffe" />
|
||||||
|
</MTProjectMetadataState>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
77
Hometask 2.py
Normal file
77
Hometask 2.py
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
my_string = "Hello, World!"
|
||||||
|
my_integer = 42
|
||||||
|
my_float = 3.14
|
||||||
|
my_bool = True
|
||||||
|
my_list = [1, 2, 3, 4, 5]
|
||||||
|
my_dict = {"key1": "value1", "key2": "value2"}
|
||||||
|
my_tuple = (1, 2, 3)
|
||||||
|
my_none = None
|
||||||
|
|
||||||
|
num1 = 10
|
||||||
|
num2 = 20
|
||||||
|
print(num1 < num2)
|
||||||
|
|
||||||
|
str1 = "apple"
|
||||||
|
str2 = "banana"
|
||||||
|
print(str1 == str2)
|
||||||
|
|
||||||
|
bool1 = True
|
||||||
|
bool2 = False
|
||||||
|
print(bool1 and bool2)
|
||||||
|
|
||||||
|
list1 = [1, 2, 3]
|
||||||
|
list2 = [1, 2, 3]
|
||||||
|
print(list1 == list2)
|
||||||
|
|
||||||
|
dict1 = {"key1": "value1", "key2": "value2"}
|
||||||
|
dict2 = {"key1": "value1", "key2": "value2"}
|
||||||
|
print(dict1 == dict2)
|
||||||
|
|
||||||
|
tuple1 = (1, 2, 3)
|
||||||
|
tuple2 = (1, 2, 3)
|
||||||
|
print(tuple1 == tuple2)
|
||||||
|
|
||||||
|
num_str = 125
|
||||||
|
num_str = str(num_str)
|
||||||
|
|
||||||
|
message = "Hi, my name is Python!"
|
||||||
|
message = message.replace('y', '0').replace('i', '1')
|
||||||
|
|
||||||
|
split_test = "This is a split test"
|
||||||
|
split_list = split_test.split(' ')
|
||||||
|
string_join = ' '.join(split_list)
|
||||||
|
|
||||||
|
length_of_string_join = len(string_join)
|
||||||
|
|
||||||
|
print(num_str)
|
||||||
|
print(message)
|
||||||
|
print(string_join)
|
||||||
|
print(length_of_string_join)
|
||||||
|
|
||||||
|
list_append = [1, 2, 3]
|
||||||
|
list_append.append(4)
|
||||||
|
list_append.append(5)
|
||||||
|
|
||||||
|
list_extend = [4, 5, 6]
|
||||||
|
list_extend.extend([7, 8, 9])
|
||||||
|
|
||||||
|
index_of_6 = list_extend.index(6)
|
||||||
|
|
||||||
|
length_of_list_append = len(list_append)
|
||||||
|
|
||||||
|
print(list_append)
|
||||||
|
print(list_extend)
|
||||||
|
print(index_of_6)
|
||||||
|
print(length_of_list_append)
|
||||||
|
|
||||||
|
dict_test = {'car': 'Toyota', 'price': 4900, 'where': 'EU'}
|
||||||
|
print(dict_test['car'])
|
||||||
|
print(dict_test['where'])
|
||||||
|
|
||||||
|
keys = dict_test.keys()
|
||||||
|
values = dict_test.values()
|
||||||
|
print(keys)
|
||||||
|
print(values)
|
||||||
|
|
||||||
|
items = dict_test.items()
|
||||||
|
print(items)
|
||||||
78
main.py
78
main.py
|
|
@ -1 +1,77 @@
|
||||||
print("Hello World!")
|
my_string = "Hello, World!"
|
||||||
|
my_integer = 42
|
||||||
|
my_float = 3.14
|
||||||
|
my_bool = True
|
||||||
|
my_list = [1, 2, 3, 4, 5]
|
||||||
|
my_dict = {"key1": "value1", "key2": "value2"}
|
||||||
|
my_tuple = (1, 2, 3)
|
||||||
|
my_none = None
|
||||||
|
|
||||||
|
num1 = 10
|
||||||
|
num2 = 20
|
||||||
|
print(num1 < num2)
|
||||||
|
|
||||||
|
str1 = "apple"
|
||||||
|
str2 = "banana"
|
||||||
|
print(str1 == str2)
|
||||||
|
|
||||||
|
bool1 = True
|
||||||
|
bool2 = False
|
||||||
|
print(bool1 and bool2)
|
||||||
|
|
||||||
|
list1 = [1, 2, 3]
|
||||||
|
list2 = [1, 2, 3]
|
||||||
|
print(list1 == list2)
|
||||||
|
|
||||||
|
dict1 = {"key1": "value1", "key2": "value2"}
|
||||||
|
dict2 = {"key1": "value1", "key2": "value2"}
|
||||||
|
print(dict1 == dict2)
|
||||||
|
|
||||||
|
tuple1 = (1, 2, 3)
|
||||||
|
tuple2 = (1, 2, 3)
|
||||||
|
print(tuple1 == tuple2)
|
||||||
|
|
||||||
|
num_str = 125
|
||||||
|
num_str = str(num_str)
|
||||||
|
|
||||||
|
message = "Hi, my name is Python!"
|
||||||
|
message = message.replace('y', '0').replace('i', '1')
|
||||||
|
|
||||||
|
split_test = "This is a split test"
|
||||||
|
split_list = split_test.split(' ')
|
||||||
|
string_join = ' '.join(split_list)
|
||||||
|
|
||||||
|
length_of_string_join = len(string_join)
|
||||||
|
|
||||||
|
print(num_str)
|
||||||
|
print(message)
|
||||||
|
print(string_join)
|
||||||
|
print(length_of_string_join)
|
||||||
|
|
||||||
|
list_append = [1, 2, 3]
|
||||||
|
list_append.append(4)
|
||||||
|
list_append.append(5)
|
||||||
|
|
||||||
|
list_extend = [4, 5, 6]
|
||||||
|
list_extend.extend([7, 8, 9])
|
||||||
|
|
||||||
|
index_of_6 = list_extend.index(6)
|
||||||
|
|
||||||
|
length_of_list_append = len(list_append)
|
||||||
|
|
||||||
|
print(list_append)
|
||||||
|
print(list_extend)
|
||||||
|
print(index_of_6)
|
||||||
|
print(length_of_list_append)
|
||||||
|
|
||||||
|
dict_test = {'car': 'Toyota', 'price': 4900, 'where': 'EU'}
|
||||||
|
print(dict_test['car'])
|
||||||
|
print(dict_test['where'])
|
||||||
|
|
||||||
|
keys = dict_test.keys()
|
||||||
|
values = dict_test.values()
|
||||||
|
print(keys)
|
||||||
|
print(values)
|
||||||
|
|
||||||
|
items = dict_test.items()
|
||||||
|
print(items)
|
||||||
Loading…
Add table
Reference in a new issue