Code Monkey home page Code Monkey logo

data-academy-python-lab's Introduction

data-academy-python-lab

Python's exercises for data academy

Getting Started

Clone this repository

  git clone [email protected]:Maclenn77/data-academy-python-lab.git

Prerrequisites

  • Python 3

Review activities

After cloning the repo,

  cd data-academy-python-lab/exercises
  python3 activity_NUMBER.py

Some tests had been added at the end of the file to review the results

Activities

Lab Activity 1: Variables and Control Flow

Objective: Introduce variables, data types, and control flow statements in Python.

  1. Declare two variables, num1 and num2, and assign them with integer values.
  2. Write a program that checks if num1 is greater than num2 and prints the result.
  3. Use an if-else statement to determine if the values of num1 and num2 are equal or not, and print an appropriate message.
  4. Prompt the user to enter a number and store it in a variable.
  5. Use a loop to print all the numbers from 1 to the user-input number.

Lab Activity 2: Functions and File Handling

Objective: Introduce functions and basic file handling operations in Python.

  1. Write a function that takes two parameters, num1 and num2, and returns their sum.
  2. Create a text file named "numbers.txt" and write a few numbers, each on a new line.
  3. Write a function that reads the numbers from the file and calculates their average.
  4. Implement a function that takes a string as input and writes it to the end of the "numbers.txt" file.
  5. Call the functions and print the results.

Lab Activity 3: Lists and Basic Algorithms

Objective: Introduce lists, basic algorithms, and list manipulation in Python.

  1. Create a list of integers containing at least 10 elements.
  2. Write a function that takes the list as input and returns the maximum and minimum values.
  3. Implement a function that reverses the order of the elements in the list.
  4. Write a function that searches for a given value in the list and returns its index.
  5. Implement a function that takes a list of numbers and returns a new list with only the even numbers.

data-academy-python-lab's People

Contributors

maclenn77 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.