print('Hello World!', 'I am sending string arguments to print ')
Hello World! I am sending string arguments to print
student_age = 17
student_name = "Hiroto Yamaguchi"
print(student_name,'will be in the class for',student_age, 'year old students.')
Hiroto Yamaguchi will be in the class for 17 year old students.
print("line 1")
print("line 2")
# line 3 is an empty return - the default when no arguments
print()
print("line 4")
line 1
line 2
line 4
#[ ] increase the number of arguments used in print() to 8 or more
student_age = 17
student_name = "Hiroto Yamaguchi"
animal="panda"
print(student_name,'will be in the class for',student_age, 'year old students.', student_name, "was mauled by a",animal, 'and "barely" survived.')
Hiroto Yamaguchi will be in the class for 17 year old students. Hiroto Yamaguchi was mauled by a panda and "barely" survived.
# defines a function named say_hi
def say_hi():
print("Hello there!")
print("goodbye")
say_hi()
Hello there!
goodbye
# define three_three
def three_three():
print(33)
three_three()
33
# Program defines and calls the say_hi & three_three functions
# [ ] review and run the code
def say_hi():
print("Hello there!")
print("goodbye")
# end of indentation ends the function
# define three_three
def three_three():
print(33)
# calling the functions
say_hi()
print()
three_three()
Hello there!
goodbye
33
#[ ] define (def) a simple function called yell_it() and call the function
def yell_it():
words=input("What do you want to yell").upper()
print(words)
yell_it()
HI HOW ARE YOU
# yell_this() yells the string Argument provided
def yell_this(phrase):
"""
Change all characters to uppercase and add exclamation point.
args:
phrase: string to be capitalized
returns:
none
"""
print(phrase.upper() + "!")
# call function with a string
yell_this("It is time to save the notebook")
IT IS TIME TO SAVE THE NOTEBOOK!
# use a default argument
def say_this(phrase = "Hi"):
"""
Change all characters to uppercase and add exclamation point.
args:
phrase: string to be capitalized
returns:
none
"""
print(phrase)
say_this()
say_this("Bye")
Hi
Bye
# [ ] define yell_this()
def yell_this(words_to_yell=input("What do you want to yell?")):
print(words_to_yell.upper())
# [ ] get user input in variable words_to_yell
# [ ] call yell_this function with words_to_yell as argument
yell_this()
yell_this("Where are they at?")
HI HOW ARE YOU
WHERE ARE THEY AT?