#     1. Import and test 3 of the functions from your functions exercise file.
#        Import each function in a different way:
#         - import the module and refer to the function with the . syntax
#         - use from to import the function directly
#         - use from and give the function a different name

import function_exercises
function_exercises.is_two(2)

import function_exercises as fe
fe.is_vowel('a')

from function_exercises import is_consonant as c
c('a')

#     2. For the following exercises, read about and use the itertools module from the 
#        standard library to help you solve the problem.
#           - How many different ways can you combine the letters from "abc" with the numbers 1, 2, and 3?
#           - How many different ways can you combine two of the letters from "abcd"?

#  - How many different ways can you combine the letters from "abc" with the numbers 1, 2, and 3?

from itertools import *
abc = list(product('abc', '123'))
print(abc)

# - How many different ways can you combine two of the letters from "abcd"?

from itertools import * # import itertools
# 1. Import and test 3 of the functions from your functions exercise file.

import function_exercises as fe
fe.get_letter_grade(84)
fe.get_letter_grade(91)

from function_exercises import is_two 
is_two(2)
is_two(3)

from function_exercises import is_consonant as con
con("a")
con("b")

# 1. How many different ways can you combine the letters from "abc" with the numbers 1, 2, and 3?
import itertools as it
it.product('abc', '123')

# 2. How many different ways can you combine two of the letters from "abcd"?
import itertools as it
it.combinations('abc, '123')

## profiles.json ##

# importing just the function needed from json module
# printing "ok" to test the import went through
from json import load
print("ok")
# importing the entire json module
import json 
#1) Import and test 3 of the functions from your functions exercise file.
# Import each function in a different way:
# import the module and refer to the function with the . syntax
import function_exercises  #importing function_exercises file

function_exercises.twelveto24('12:30am')  #running twelveto24 function

# use from to import the function directly
from function_exercises import is_two  #importing is_two function

is_two(2)  #running is_two function

# use from and give the function a different name
from function_exercises import is_vowel as isv  #importing is_vowel function renamed as isv

isv('a')  #running is_vowel function

#For the following exercises, read about and use the itertools module
#from the standard library to help you solve the problem.
#How many different ways can you combine the letters
#from "abc" with the numbers 1, 2, and 3?
from itertools import product  #from itertools library, import product function

print(list(product(
    'abc', '123')))  #print the list of combinations for 'abc' and '123'
len(list(product('abc',
                 '123')))  #give the amount of combinations for 'abc' and '123'

#How many different ways can you combine
#two of the letters from "abcd"?
from itertools import combinations as comb  #from itertools library, import combinations function as comb
Esempio n. 4
0
# 1)Import each function in a different way:

# import the module and refer to the function with the . syntax

import function_exercises

function_exercises.is_two(3)
function_exercises.is_vowel("b")
function_exercises.is_consonant("e")

# use from to import the function directly

from function_exercises import is_two
from function_exercises import is_vowel
from function_exercises import is_consonant

is_vowel("b")

# use from and give the function a different name

import function_exercises as fe

fe.is_two(9)
fe.is_vowel("i")
fe.is_consonant("h")

# How many different ways can you combine the letters from "abc" with the numbers 1, 2, and 3?

from itertools import product

letters = "abc"
Esempio n. 5
0

# In[ ]:


# -import the module and refer to the function with the . syntax
import function_exercises
function_exercises.is_vowel("a")


# In[ ]:


# -use from to import the function directly
from function_exercises import is_two
is_two(2)


# In[ ]:


# -use from and give the function a different name
from function_exercises import get_letter_grade
get_letter_grade(85)


# In[ ]:


# For the following exercises, read about and use the itertools module from the standard library to help
# you solve the problem.
#!/usr/bin/env python
# coding: utf-8

# ### Import and test 3 of the functions from your functions exercise file.
#
# Import each function in a different way:
#
# - Import the module and refer to the function with the `.` syntax

# In[1]:

import function_exercises as fe

# In[2]:

print(fe.is_two(2))

# - Use `from` to import the function directly

# In[3]:

from function_exercises import is_vowel

# In[4]:

print(is_vowel('u'))

# - Use `from` and give the function a different name

# In[5]:
Esempio n. 7
0
# Below CV stands for Class Version upon whole class review

# 1. Import and test 3 of the functions from your functions exercise file.

import function_exercises

assert function_exercises.is_two(2) == True
assert function_exercises.is_two('two') == False

from function_exercises import is_two

assert is_two(2) == True
assert is_two('two') == False

from function_exercises import is_two as is_it_two

assert is_it_two(2) == True
assert is_it_two('two') == False

import function_exercises

assert function_exercises.is_vowel('c') == False
assert function_exercises.is_vowel('a') == True

from function_exercises import is_vowel

assert is_vowel('c') == False
assert is_vowel('a') == True

from function_exercises import is_vowel as is_this_a_vowel
#!/usr/bin/env python
# coding: utf-8

# ## 1.
# > Import and test 3 of the functions from your functions exercise file.
#

# In[6]:

import function_exercises

# > Import the module and refer to the function with the `.` syntax.

# In[7]:

function_exercises.is_two('2')

# > use `from` to import the function directly.

# In[8]:

from function_exercises import remove_vowels
remove_vowels('This is a sentence with vowels removed!')

# > Use `from` and give the function a different name.

# In[9]:

from function_exercises import twelveto24 as military_time
military_time("12:00pm")