Skip to content

Latest commit

 

History

History

0x01-python-if_else_loops_functions

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

Resources:books:

Read or watch:


Learning Objectives:bulb:

What you should learn from this project:

  • Why Python programming is awesome (don’t forget to tweet today, with the hashtag #pythoniscool :))
  • 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

  • This program will assign a random signed number to the variable number each time it is executed. Complete the source code in order to print whether the number stored in the variable number is positive or negative.
  • This program will assign a random signed number to the variable number each time it is executed. Complete the source code in order to print the last digit of the number stored in the variable number.
  • Write a program that prints the ASCII alphabet, in lowercase, not followed by a new line.
  • Write a program that prints the ASCII alphabet, in lowercase, not followed by a new line.
  • Write a program that prints all numbers from 0 to 98 in decimal and in hexadecimal (as in the following example)
  • Write a program that prints numbers from 0 to 99.
  • Write a program that prints all possible different combinations of two digits.
  • Write a function that checks for lowercase character.
  • Write a function that prints a string in uppercase followed by a new line.
  • Write a function that prints the last digit of a number.
  • Write a function that adds two integers and returns the result.
  • Write a function that computes a to the power of b and return the value.
  • Write a function that prints the numbers from 1 to 100 separated by a space.
  • Technical interview preparation:
  • Write a program that prints the ASCII alphabet, in reverse order, alternating lowercase and uppercase (z in lowercase and Y in uppercase) , not followed by a new line.
  • Write a function that creates a copy of the string, removing the character at the position n (not the Python way, the “C array index”).
  • Write the Python function def magic_calculation(a, b, c): that does exactly the same as the following Python bytecode:

Author