diff --git a/0x00-python-hello_world/0-run b/0x00-python-hello_world/0-run deleted file mode 100755 index 130ce2b..0000000 --- a/0x00-python-hello_world/0-run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -python3 $PYFILE diff --git a/0x00-python-hello_world/1-run_inline b/0x00-python-hello_world/1-run_inline deleted file mode 100755 index f647a2d..0000000 --- a/0x00-python-hello_world/1-run_inline +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -python3 -c "$PYCODE" diff --git a/0x00-python-hello_world/10-check_cycle.c b/0x00-python-hello_world/10-check_cycle.c deleted file mode 100755 index ea59b55..0000000 --- a/0x00-python-hello_world/10-check_cycle.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "lists.h" - -/** - * check_cycle - check for loop in LL - * @list: head of linked list - * - * Description - check for loops in LL - * Return: 1 if cycled, 0 if not - */ - -int check_cycle(listint_t *list) -{ - listint_t *slow, *fast; - - if (!list) - { - return (0); - } - slow = list; - fast = list->next; - while (fast && slow && fast->next) - { - if (slow == fast) - { - return (1); - } - slow = slow->next; - fast = fast->next->next; - } - return (0); -} diff --git a/0x00-python-hello_world/10-linked_lists.c b/0x00-python-hello_world/10-linked_lists.c deleted file mode 100755 index 130a8df..0000000 --- a/0x00-python-hello_world/10-linked_lists.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include "lists.h" - -/** - * print_listint - prints all elements of a listint_t list - * @h: pointer to head of list - * Return: number of nodes - */ -size_t print_listint(const listint_t *h) -{ - const listint_t *current; - unsigned int n; - - current = h; - n = 0; - while (current != NULL) - { - printf("%i\n", current->n); - current = current->next; - n++; - } - return (n); -} - -/** - * add_nodeint - adds a new node at the beginning of a listint_t list - * @head: pointer to a pointer of the start of the list - * @n: integer to be included in node - * Return: address of the new element or NULL if it fails - */ -listint_t *add_nodeint(listint_t **head, const int n) -{ - listint_t *new; - - new = malloc(sizeof(listint_t)); - if (new == NULL) - { - return (NULL); - } - new->n = n; - new->next = *head; - *head = new; - return (new); -} - -/** - * free_listint - frees a listint_t list - * @head: pointer to list to be freed - * Return: void - */ -void free_listint(listint_t *head) -{ - listint_t *current; - - while (head != NULL) - { - current = head; - head = head->next; - free(current); - } -} diff --git a/0x00-python-hello_world/10-main.c b/0x00-python-hello_world/10-main.c deleted file mode 100755 index 90accb3..0000000 --- a/0x00-python-hello_world/10-main.c +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include -#include "lists.h" - -/** - * main - check the code for Holberton School students. - * - * Return: Always 0. - */ -int main(void) -{ - listint_t *head; - listint_t *current; - listint_t *temp; - int i; - - head = NULL; - add_nodeint(&head, 0); - add_nodeint(&head, 1); - add_nodeint(&head, 2); - add_nodeint(&head, 3); - add_nodeint(&head, 4); - add_nodeint(&head, 98); - add_nodeint(&head, 402); - add_nodeint(&head, 1024); - print_listint(head); - - if (check_cycle(head) == 0) - printf("Linked list has no cycle\n"); - else if (check_cycle(head) == 1) - printf("Linked list has a cycle\n"); - - current = head; - for (i = 0; i < 4; i++) - current = current->next; - temp = current->next; - current->next = head; - - if (check_cycle(head) == 0) - printf("Linked list has no cycle\n"); - else if (check_cycle(head) == 1) - printf("Linked list has a cycle\n"); - - current = head; - for (i = 0; i < 4; i++) - current = current->next; - current->next = temp; - - free_listint(head); - - return (0); -} diff --git a/0x00-python-hello_world/100-write.py b/0x00-python-hello_world/100-write.py deleted file mode 100755 index 1b1d050..0000000 --- a/0x00-python-hello_world/100-write.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/python3 -import sys -sys.stderr.write("and that piece of art is useful - Dora Korpar, 2015-10-19\n") -sys.exit(1) diff --git a/0x00-python-hello_world/101-compile b/0x00-python-hello_world/101-compile deleted file mode 100755 index c0dd7d4..0000000 --- a/0x00-python-hello_world/101-compile +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -python3 -c "import py_compile; py_compile.compile('$PYFILE', '$PYFILE' + 'c')" diff --git a/0x00-python-hello_world/102-magic_calculation.py b/0x00-python-hello_world/102-magic_calculation.py deleted file mode 100755 index c0686c8..0000000 --- a/0x00-python-hello_world/102-magic_calculation.py +++ /dev/null @@ -1,2 +0,0 @@ -def magic_calculation(a, b): - return (98 + a ** b) diff --git a/0x00-python-hello_world/2-print.py b/0x00-python-hello_world/2-print.py deleted file mode 100755 index 8a20627..0000000 --- a/0x00-python-hello_world/2-print.py +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/python3 -print("\"Programming is like building a multilingual puzzle") diff --git a/0x00-python-hello_world/3-print_number.py b/0x00-python-hello_world/3-print_number.py deleted file mode 100755 index aaab32d..0000000 --- a/0x00-python-hello_world/3-print_number.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/python3 -number = 98 -print(f"{number:d} Battery street") diff --git a/0x00-python-hello_world/4-print_float.py b/0x00-python-hello_world/4-print_float.py deleted file mode 100755 index adf78cb..0000000 --- a/0x00-python-hello_world/4-print_float.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/python3 -number = 3.14159 -print(f"Float: {number:.2f}") diff --git a/0x00-python-hello_world/5-print_string.py b/0x00-python-hello_world/5-print_string.py deleted file mode 100755 index bfa1a0b..0000000 --- a/0x00-python-hello_world/5-print_string.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/python3 -str = "Holberton School" -print(str * 3) -print(str[:9]) diff --git a/0x00-python-hello_world/6-concat.py b/0x00-python-hello_world/6-concat.py deleted file mode 100755 index 1ebab3b..0000000 --- a/0x00-python-hello_world/6-concat.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/python3 -str1 = "Holberton" -str2 = "School" -str1 += (" " + str2) -print("Welcome to {}!".format(str1)) diff --git a/0x00-python-hello_world/7-edges.py b/0x00-python-hello_world/7-edges.py deleted file mode 100755 index b423d94..0000000 --- a/0x00-python-hello_world/7-edges.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python3 -word = "Holberton" -word_first_3 = word[:3] -word_last_2 = word[-2:] -middle_word = word[1:-1] -print("First 3 letters: {}".format(word_first_3)) -print("Last 2 letters: {}".format(word_last_2)) -print("Middle word: {}".format(middle_word)) diff --git a/0x00-python-hello_world/8-concat_edges.py b/0x00-python-hello_world/8-concat_edges.py deleted file mode 100755 index 188c308..0000000 --- a/0x00-python-hello_world/8-concat_edges.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/python3 -str = "Python is an interpreted, interactive, object-oriented programming\ - language that combines remarkable power with very clear syntax" -str = str[39:67] + str[107:112] + str[:6] -print(str) diff --git a/0x00-python-hello_world/9-easter_egg.py b/0x00-python-hello_world/9-easter_egg.py deleted file mode 100755 index ed92885..0000000 --- a/0x00-python-hello_world/9-easter_egg.py +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/python3 -import this diff --git a/0x00-python-hello_world/README.md b/0x00-python-hello_world/README.md deleted file mode 100644 index 3fa314b..0000000 --- a/0x00-python-hello_world/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# 0x00. Python - Hello, World -This folder contains a basic introduction of the python programming language. - -### Note: When doing this project, After using text editor of your choice to create and access the file on insert mode.Ensure the first line of all your files should be exactly `#!/bin/bash`, then the second line is having the correct command/answer. -(From your terminal, convert the file created to `SCRIPT` i.e: chmod u+x filename `Else the last checker on task 0 and task 1 won't check`) - -## Contents -- [0-run](0-run) : a Shell script that runs a Python script. -- [1-run_inline](1-run_inline) : a Shell script that runs Python code. -- [2-print.py](2-print.py) : a Python script that prints exactly "Programming is like building a multilingual puzzle, followed by a new line. -- [3-print_number.py](3-print_number.py) : a program that prints the integer stored in the variable ```number``` , followed by Battery street, followed by a new line. -- [4-print_float.py](4-print_float.py) : print the float stored in the variable ```number``` with a precision of 2 digits. -- [5-print_string.py](5-print_string.py) : print 3 times a string stored in the variable str, followed by its first 9 characters. -- [6-concat.py](6-concat.py) : print ```Welcome to Holberton School!``` -- [7-edges.py](7-edges.py) : print excluded characters of a given string. -- [8-concat_edges.py](8-concat_edges.py) : print object-oriented programming with Python, followed by a new line. -- [9-easter_egg.py](9-easter_egg.py) : a Python script that prints “The Zen of Python”, by TimPeters, followed by a new line. -- [10-check_cycle.c](10-check_cycle.c) : AN INTERVIEW QUESTION - a function in C that checks if a singly linked list has a cycle in it. -- [100-write.py](100-write.py) : a Python script that prints exactly ```and that piece of art is useful - Dora Korpar, 2015-10-19,``` followed by a new line. -- [101-compile](101-compile) : a script that compiles a Python script file. -- [102-magic_calculation.py](102-magic_calculation.py) : Python function ```def magic_calculation(a, b):``` that does exactly the same as the given Python bytecode -- [lists.h](lists.h) : contains the header file used in [10-check_cycle.c](10-check_cycle.c) - -## Resources -- [Python documentation](https://docs.python.org/3/tutorial/index.html) -- [Youtube series](https://www.youtube.com/playlist?list=PLGLfVvz_LVvTn3cK5e6LjhgGiSeVlIRwt) -- [Pycodestyle guide](https://alx-intranet.hbtn.io/rltoken/zbSpP5Q7q3JUCAWDL2z9Wg) -- [Understanding The Zen of Python](https://www.youtube.com/watch?v=uBHOb55-fBo) diff --git a/0x00-python-hello_world/lists.h b/0x00-python-hello_world/lists.h deleted file mode 100755 index feac1c8..0000000 --- a/0x00-python-hello_world/lists.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef LISTS_H -#define LISTS_H - -#include - -/** - * struct listint_s - singly linked list - * @n: integer - * @next: points to the next node - * - * Description: singly linked list node structure - * for Holberton project - */ -typedef struct listint_s -{ - int n; - struct listint_s *next; -} listint_t; - -size_t print_listint(const listint_t *h); -listint_t *add_nodeint(listint_t **head, const int n); -void free_listint(listint_t *head); -int check_cycle(listint_t *list); - -#endif /* LISTS_H */ diff --git a/0x00-python-hello_world/main.py b/0x00-python-hello_world/main.py deleted file mode 100755 index 7788dd9..0000000 --- a/0x00-python-hello_world/main.py +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/python3 -print("Holberton School") diff --git a/0x01-python-if_else_loops_functions/README.md b/0x01-python-if_else_loops_functions/README.md new file mode 100644 index 0000000..e69de29