- The Python Tutorial (only the first three chapters below)
- Whetting Your Appetite
- Using the Python Interpreter
- An Informal Introduction to Python (Read up until “3.1.2. Strings” included)
- How to use string formatters in Python 3
-
Run Python file : Write a Shell script that runs a Python script.
- The Python file name will be saved in the environment variable
$PYFILE
guillaume@ubuntu:~/py/0x00$ cat main.py #!/usr/bin/python3 print("Holberton School") guillaume@ubuntu:~/py/0x00$ export PYFILE=main.py
- The Python file name will be saved in the environment variable
-
Run inline : Write a Shell script that runs Python code.
- The Python code will be saved in the environment variable
$PYCODE
guillaume@ubuntu:~/py/0x00$ export PYCODE='print("Holberton School: {}".format(88+10))'
- The Python code will be saved in the environment variable
-
Hello, print : Write a Python script that prints exactly
"Programming is like building a multilingual puzzle, followed by a new line.- Use the function
print
- Use the function
-
Print integer : Complete the source code in order to print the integer stored in the variable
number, followed byBattery street, followed by a new line.- You can find the source code here
- The output of the script should be:
- the number, followed by
Battery street, - followed by a new line.
- the number, followed by
- You are not allowed to cast the variable
numberinto a string. - Your code must be 3 lines long
- You have to use the new print numbers tips (with
.format(...))
C is strongly typed… not in Python! The variable
numbercan be assigned to a string, a float, a bool etc… Forcing the type during a string format ("...".format(...)) is a way to control the type of a variable -
Print float : Complete the source code in order to print the float stored in the variable
numberwith a precision of 2 digits. -
Print string : Complete the source code in order to print 3 times a string stored in the variable
str, followed by its first 9 characters.- You can find the source code here
- The output of the program should be:
- 3 times the value of
str - followed by a new line
- followed by the 9 first characters of
str - followed by a new line
- 3 times the value of
- You are not allowed to use any loops or conditional statement
- Your program should be maximum 5 lines long
-
Play with strings : Complete this source code to print
Welcome to Holberton School!- You can find the source code here
- You are not allowed to use any loops or conditional statements.
- You have to use the variables
str1andstr2in your new line of code. - Your program should be exactly 5 lines long
-
Copy - Cut - Paste : Complete this source code.
- You can find the source code here
- You are not allowed to use any loops or conditional statements
- Your program should be exactly 8 lines long
word_first_3should contain the first 3 letters of the variablewordword_last_2should contain the last 2 letters of the variablewordmiddle_wordshould contain the value of the variablewordwithout the first and last letters
-
Create a new sentence : Complete this source code to print
object-oriented programming with Python, followed by a new line.- You can find the source code here
- You are not allowed to use any loops or conditional statements
- Your program should be exactly 5 lines long
- You are not allowed to create new variables
- You are not allowed to use string literals
-
Easter Egg : Write a Python script that prints “The Zen of Python”, by TimPeters, followed by a new line.
- Your script should be maximum 98 characters long (please check with
wc -m 9-easter_egg.py) 10 Linked list cycle Technical interview preparation: - You are not allowed to google anything
- Whiteboard first
- This task and all future technical interview prep tasks will include checks for the efficiency of your solution, i.e. is your solution’s runtime fast enough, does your solution require extra memory usage / mallocs, etc.
- Write a function in C that checks if a singly linked list has a cycle in it.
- Prototype:
int check_cycle(listint_t *list); - Return:
0if there is no cycle,1if there is a cycle
- Prototype:
- Requirements:
- Only these functions are allowed:
write,printf,putchar,puts,malloc,free
- Only these functions are allowed:
- Compile the code this way:
gcc -Wall -Werror -Wextra -pedantic 10-main.c 10-check_cycle.c 10-linked_lists.c -o cycle - Solving a problem is already a big win! but finding the best and optimal way to solve it, it’s way better! Think about the most optimal / fastest way to do it.
- Your script should be maximum 98 characters long (please check with
- 10. Linked list cycle
- 10-check_cycle.c: C function that checks if a linked list contains a cycle.
- Returns
0if there is no cycle and1if there is. - Helper files:
- linked_lists.c: C functions handling linked lists for testing 10-check_cycle.c (provided by Holberton School).
- lists.h: Header file containing definitions and prototypes for all types and functions used in linked_lists.c and 10-check_cycle.c.
- Hello, write**
- 100-write.py: Python script that prints exactly
and that piece of art is useful - Dora Korpar, 2015-10-19, followed by a new line tostderrusing the functionwritefrom thesysmodule. - Exits with a status code of
1.
- Compile**
- 101-compile: Python script that compiles a Python script file stored
in the environment variable
$PYFILEand saves it to an output file$PYFILEc(ex.export PYFILE=my_main.py=> output filename:my_main.pyc).
- ByteCode -> Python #1**
- 102-magic_calculation.py: Python function matching exactly a bytecode provided by ALX.