General Assembly Logo

Learning Python

You've learned JavaScript. Getting started with a totally new language doesn't have to be hard. The biggest key is to practice doing something that you already know in the context of the new language. This is called a transfer task. The more languages and computer science concepts you learn, the easier new ones become to pick up and its mostly syntax, quirks and language-specific tools that become the tricky part.

Now, your task is to teach yourself a bit of Python. The goal here isn't to become a Python master, but to explore and learn a bit about a new language.

All exercises below should be done with Python 3

Goals:

By the end of this exercise, you should be able to:

  • Create a simple python program
  • Execute a simple python program
  • Articulate basic differences between Python and other languages you know
  • Feel comfortable understanding what is generally happening in most basic python programs

Research: What is Python

Your first task is to research Python to be able to understand some of its basic concepts. Edit this README.md file to answer the below questions:

What paradigms does Python support?

Python supports imperative, functional, procedural, and object-oriented programming

What typing discipline does it follow?

Python Is a Dynamically Typed Language.

Is it a high or low level language?

high-level language

Does it have built in memory management and garbage collection?

yes, it does.

What languages was Python influenced by?

inspired from other programming languages like C, C++.

Is it a compiled or interpeted language?

Python is an interpreted language.

Does it have strong support for functional programming?

yes, it does.

Hello World

Write a program in hello_world/hello_world.py that prints 'Hello, World!' to the standard output (terminal).

Fizzbuzz

Write a program in fizzbuzz/fizzbuzz.py that does the following:

For numbers 1 through 100, print fizz if the number is divisible by 3, buzz if the number is divisible by 5 and fizzbuzz if the number if the number is divisible by both 3 and 5. If the number isn't divisible by 3 or 5, just output the number itself.

The output should look something like 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 Fizz Buzz 16 17 Fizz...

Fibonacci

Write a program in fibonacci/fib.py that will output the N-th term of the Fibonacci sequence.

For example: print fib(6) should output 8.

Project Euler Problem 1

Project Euler's first problem is:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.

Write the code to complete this in euler_1/sum_of_natural_numbers.py

Conclusion

How does Python compare to other langauges you've used?