forked from Ada-Interview-Practice/De-rusting-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
146 lines (77 loc) · 3.06 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
'''
Here's a study guide to practice core Python syntax.
For each task, beneath the comment write the code and print out the result to check it works
'''
'''LISTS'''
# Create a list and assign it to a variable
# Find the length of the list
# Append an item to the list
# Find the value of an item in the list a specific index
# Set the value of an item at a specific index
# Check whether an item is in the list
# Sort the list
# Iterate over the list using range, printing out each element and the index
# Iterate over the list without using range, printing out each element
'''TUPLES'''
# Create a tuple and assign it to a variable
# Find the length of the tuple
# Find the value of an item in the tuple a specific index
# Check whether an item is in the tuple
# Iterate over the tuple using range, printing out each element and the index
# Iterate over the tuple without using range, printing out each element
'''STRINGS'''
# Create a string and assign it to a variable
# Find the length of the string
# Find the value of an character in the string a specific index
# Check whether an item is in the string
# Concatenate (add) two strings together
# Create an f-string
# Split a string using .split
# Join a list of strings using .join
# Iterate over the string using range, printing out each character and the index
# Iterate over the string without using range, printing out each character
'''DICTIONARIES'''
# Create a dictionary and assign it to a variable
# Find the length of the dictionary
# Add a new key/value pair
# Replace value for a given key
# Check whether a key is in the dictionary
# Iterate over keys, printing each key
# Iterate over over key/value pairs using .items(), printing each key and value
'''SETS'''
# Create a set and assign it to a variable
# Find the length of the set
# Add a new element
# Remove an element
# Check whether a element is in the set
# Iterate over elements, printing each one out
'''NUMBERS'''
# Add / subtract / multiply 2 numbers
# Divide two numbers using normal (float) division
# Divide two numbers using integer division
# Find the modulo (remainder) of two numbers
# Check whether a number is even/odd
# Round a float down to an int
'''FUNCTIONS'''
# Write a function that takes no arguments and call it
# Write a function that takes one or more arguments and call it
# Write a function that returns a value. Call the function and store the return value in a variable
'''LOOPS'''
# Write a while loop
# Write a for loop that loops a set number of times (e.g. 10 times)
'''CONDITIONALS'''
# Write an if/elif/else statement
# Write conditionals for the following operators:
# ==
# !=
# <
# >
# <=
# >=
'''NESTED DATA'''
# Write a nested list (a list of lists) and assign it to a variable
# Print an item at a specific position in the data structure (e.g. the item at a given row and column). HINT: row comes first, column comes second
# Iterate through the nested data structure using range
# Iterate through the nested data structure without using range
'''REMINDER'''
# You're doing great and you got this!