Skip to content

Latest commit

 

History

History

0x01-python-if_else_loops_functions

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

0x01. Python - if/else, loops, functions

Learning objectives for this project:

  • Why Python programming is awesome
  • Why indentation is so important in Python
  • How to use the if, if ... else statements
  • How to use comments
  • How to affect values to variables
  • How to use the while and for loops
  • How is Python’s for different from C‘s?
  • How to use the break and continues statements
  • How to use else clauses on loops
  • What does the pass statement do, and when to use it
  • How to use range
  • What is a function and how do you use functions
  • What does return a function that does not use any return statement
  • Scope of variables
  • What’s a traceback
  • What are the arithmetic operators and how to use them

Tasks :page_curl:

  • 0. Positive anything is better than negative nothing

    • 0-positive_or_negative.py: This program assigns a random signed number to the variable number each time it is executed and prints whether the number stored is positive or negative.
  • 1. The last digit

    • 1-last_digit.py: This program assigns a random signed number to the variable number each time it is executed and prints the last digit of the number stored.
  • 2. I sometimes suffer from insomnia. And when I can't fall asleep, I play what I call the alphabet game

    • 2-print_alphabet.py: This program prints the alphabet in lowercase, not followed by a new line.
  • 3. When I was having that alphabet soup, I never thought that it would pay off

    • 3-print_alphabt.py: This program prints the alphabet in lowercase, not followed by a new line, except for the letters q and e.
  • 4. Hexadecimal printing

    • 4-print_hexa.py: This program prints all numbers from 0 to 98 in decimal and in hexadecimal.
  • 5. 00...99

    • 5-print_comb2.py: This program prints numbers from 0 to 99 separated by , , in ascending order with two digits.
  • 6. Inventing is a combination of brains and materials. The more brains you use, the less material you need

    • 6-print_comb3.py: This program prints all possible different combinations of two digits in ascending order with two digits.
  • 7. islower

    • 7-islower.py: This function checks for lowercase characters.
  • 8. To uppercase

    • 8-uppercase.py: This function prints a string in uppercase followed by a new line.
  • 9. There are only 3 colors, 10 digits, and 7 notes; it's what we do with them that's important

  • 10. a + b

    • 10-add.py: This function adds two integers and returns the result.
  • 11. a ^ b

    • 11-pow.py: This function computes a to the power of b and returns the value.
  • 12. Fizz Buzz

    • 12-fizzbuzz.py: This function prints the numbers from 1 to 100 separated by a space.
      • For multiples of three, Fizz is printed instead of the number.
      • For multiples of five, Buzz is printed instead of the number.
      • For multiples of both three and five, FizzBuzz is printed instead of the number.
  • 13. Insert in sorted linked list

    • 13-insert_number.c: This function inserts a number into a sorted singly-linked list.
      • If the function fails, it returns NULL.
      • Otherwise, the function returns the address of the new node.
  • 14. Smile in the mirror

    • 100-print_tebahpla.py: This program prints the alphabet in reverse order, alternating lowercase and uppercase (z in lowercase and Y in uppercase) not followed by a new line.
  • 15. Remove at position

    • 101-remove_char_at.py: This function creates a copy of a string, removing the character at the position n (not the Python way, the “C array index”).
      • If n is negative or out of range, the function returns the original string.
      • Otherwise, the function returns the new string.
  • 16. ByteCode -> Python #2