Giter Club home page Giter Club logo

dsc-chi-warmup-simple-python-warmup's Introduction

Light Coding Practice

from test_scripts.test_class import Test
test = Test()

#1

Validate a string.

Please define a function called alphanumeric that validates if a user input string is alphanumeric.

The function receives a string, and outputs either True or False.

The given string is not nil/null/NULL/None, so you don't have to check that.

The string has the following conditions to be alphanumeric:

  • Allowed characters are uppercase / lowercase latin letters and digits from 0 to 9
  • No whitespaces / underscore
def alphanumeric(string):
    pass

Test your function with the cell below

test.test_alphanumeric(alphanumeric)

#2

Find the difference between two sets.

In the following cell, we import two sets.

  • car_owners = A set of car owners within a community
  • church_goers A set of people from the same community who regularly attend chuch
import pickle

path = os.path.join('data', 'car_owners.pkl')
with open(path, 'rb') as driver_file:
    car_owners = pickle.load(driver_file)
    
path = os.path.join('data', 'church_goers.pkl')
with open(path, 'rb') as church_file:
    church_goers = pickle.load(church_file)

In cell below, find the members of the community that do not own cars and attend church regularly.

# Your code here
non_driving_church_goers = None

Test the results with the cell below

test.run_test(non_driving_church_goers, 'set_problem')

#3

We want to identify the individual words within hashtags.

Every hashtag will use PascalCase which means every word will begin with a capital letter.

In the cell below, define a function called split_hashtag that splits a given hashtag into individual words, and returns those words as a list of string.

The function should not return any words with a '#' character.

# Your code here
def split_hashtag(string):
    pass

Run the cell below to test your function!

test.test_hashtag(split_hashtag)

dsc-chi-warmup-simple-python-warmup's People

Contributors

joelsewhere avatar

Watchers

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