Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
10327 views
ubuntu2004
Kernel: Python 3 (system-wide)

Exercise 19.1

Write a function called string_length() that prints the length of the word "Hello". Don't forget the doc-string.

def string_length(): '''Print the length of "Hello"''' print( len('Hello') ) string_length()

Exercise 19.2

Write a function called hello_me() that asks for input of your name then prints "Hello" followed by your name.

def hello_me(): '''Print "Hello name"''' name = input('Enter your name: ') print( f'Hello {name}' ) hello_me()

Exercise 19.3

Write a function called multiply_two_numbers() that asks for input of two numbers and then prints their product.

def multiply_two_numbers(): '''Enter two numbers and print their product''' x = float(input('Enter a number: ')) y = float(input('Enter a number: ')) print(x*y) multiply_two_numbers()