# ERROR HANDLING WITH TRY-EXCEPT
def echo(word, e=1):
"""Concatenate echo copies of a word"""
try:
echo_word = word1 * e
except:
print("word must be a string and echo must be an integer.")
return echo_word
# Call the function
echo("hello", 5)
# ERROR HANDLING WITH RAISE
# Define shout_echo
def echo(word, e=1):
"""Concatenate echo copies of a word"""
word = '""
# Raise an error with raise
if e < 0:
raise ValueError('e must be greater than 0')
echo_word = word * e
return echo_word
# Call the function
echo("hello", 5)
Categories
Bash
(3)
BOT
(2)
C#
(1)
Cluster Analysis
(1)
Data Cleaning
(6)
Data Ingestion
(2)
Data Science Specialization
(10)
Data Visualization
(15)
ggplot2
(1)
Hadoop
(1)
Hashnode
(3)
Machine Learning
(5)
MapReduce
(1)
Maps
(1)
Markdown
(7)
Market Basket Analysis
(1)
MATLAB
(1)
Matplotlib
(3)
Numpy
(2)
Octave
(1)
Pandas
(3)
Python
(17)
R
(22)
Regression
(7)
scikit-learn
(1)
Seaborn
(1)
Shell
(3)
Shiny App
(1)
SSIS
(3)
Statistical Inference
(2)
T-SQL
(8)
Unix
(3)
No comments:
Post a Comment