print()
round()
type()
input()
len()
int()
float()
Write a Python function that does the following:
greeting
first_name
and last_name
first_name
and last_name
input()
functioninput()
function prompts the user to input text in the standard outputinput()
will be written to the standard output (without a trailing newline, which you can add using \n
).input()
always returns a stringWrite a Python function that does the following:
greeting_again
with no parametersgreeting
but replace with your first and last namedef greeting(first, last):
message = "Hello, " + first + " " + last + "!"
return message
def greeting_again():
first = input("Enter your first name:\n")
last = input("Enter your last name:\n")
message = "Hello, " + first + " " + last + "!"
return message
def main():
print(greeting("Mickey", "Mouse"))
print(greeting_again())
main()
len()
functionlen()
function can be used with many types – we will be using it with string
for nowWrite a Python function that does the following:
count_characters
a
, b
and c
You have 10 minutes to complete the quiz.
Your formula in your function should be Python code (in other words, do not just copy the formula in the instructions, make it so it uses actual symbols for Python operators)
int()
functionint()
function can be used to convert a string to an integer typefloat()
functionfloat()
function can be used to convert a string to a float typeWrite a Python function calculate_year_born
with no parameters. It prompts user to enter their age input()
.
It converts user’s age
to integer and calculates (imperfectly) the year a person of age
was born by subtracting age
from 2025
.
It returns an integer representing the approximate year person of age
was born.