Git Product home page Git Product logo

quiz-itp-w1's Introduction

Intro to Python - Week 1 - Quiz

This small quiz is just for validating the concepts covered during the first week of our course. It's not something you can pass or fail. We use the results of this quiz to evaluate if we need to add more support sessions or improve any aspect of the course.

PLEASE, don't cheat. Make it honest. We'll never share the data with the rest of the class.

To complete this quiz, fork the repo, work on main.py and submit a Pull Request

Question 1

What's the correct data type of the following values: True, False

Options:
a) Integer
b) Boolean
c) String
d) Collection

Question 2

What's the final result of the following operation:

result = True or ("" and False and []) or (1 and "hello world")
Options:
a) []
b) 1
c) True
d) False
e) "hello world"

Question 3

Write a function remove_Es that receives a string and removes all the characters 'e' or 'E'. Example:

remove_Es('remoter')  # 'rmotr'
remove_Es('eEe')      # ''
remove_Es('abc')      # 'abc'

Question 4

Given the following two collections:

a_tuple = (19, 33, 12)
a_list = range(0, 10)

What's the final value of result?

result = a_list[3**2 - 8] + a_list[-1] + a_tuple[2]

Question 5

Write a function calculate_tax that receives a number (income) and calculates how much of Federal taxes is due, according to the following table:

Income Tax Percentage
<= $50,000 15%
<= $75,000 25%
<= $100,000 30%
> $100,000 35%

Example:

income = 30000  # $30,000 is less than $50,000
calculate_tax(income)  # $30,000 * 0.15  = 4500 = $4,500

income = 80000  # $80,000 is more than $75,000 but less than $80,000
calculate_tax(income)  # $80,000 * 0.25 = 20000 = $20,000

income = 210000  # $210,000 is more than $100,000
calculate_tax(income)  # $210,000 * 0.35 = 73500 = $73,500

Question 6

Write a function matrix_sum that sums all the values in a square matrix.

Example:

m1 = [
    [2, 9, 1],
    [3, 1, 18],
    [22, 8, 16]
]
m2 = [
    [81, 29],
    [31, 57]
]

matrix_sum(m1)  #  80
matrix_sum(m2)  # 198

quiz-itp-w1's People

Contributors

santiagobasulto avatar kabayomi avatar

Watchers

James Cloos avatar  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.