Lecture 0 - Functions, Variables Flashcards
are verbs or actions that the computer or computer language will already know how to perform
Functions
This function takes arguments
Print()
a function that takes a prompt as an argument
Input()
A container for a value you set within your own program.
Variable
Variable Syntax
name = input(“What’s your name? “)
print(“hello,”)
print(name)
A way for programmers to track what they are doing in their programs and even inform others about their intentions for a block of code.
Comments
Comments Syntax
Ask the user for their name
name = input(“What’s your name? “)
print(“hello,”)
print(name)
What does Str stand for?
String
Are variables that are defined in the function definition. They are assigned the values which were passed as arguments when the function was called, elsewhere in the code.
Parameters
A type of escape character that will create a new line when used
\n
Unique indicator that identifies a string is used for formatting
F Strings
F Syntax
print(f”hello, {name}”)
A method that removes spaces at the beginning and at the end of the string
Strip()
Strip() Syntax
name = name.strip()
A method returns a string where the first character in every word is upper case.
Title()