Student Current Projects
#Cloe Fraser #Activity #We are going to create a word guessing game. #The game selects a random word form a list of words. #The game then gives 3 letters as clues as to what the word is in the correct position. #The player has 5 chances to guess each word. #Each word the player guesses correctly he gets a point. #If he misses all five chances it moves to thhttps://www.onlinegdb.com/online_python_compiler#editor_1e nex word. #The total number of words selected in each game is 10. #At the end of the game the player gets a total score. import random words = [ "apple", "grape", "bread", "stone", "chair", "plant", "light", "candy", "smile", "brave", "drift", "sword", "clock", "river", "flame", "cloud", "table", "spice", "drink", "dream", "grass", "lucky", "mouse", "sweet", "tight", "paper", "green", "chase", "float", "clean", "flock", "globe", "heavy", "lemon", "magic", "night", "ocean", "pearl", "quiet", "rapid", "shine", "spoon", "train", "uncle", "vivid", "water", "young", "zebra", "angel", "bloom", "climb", "dance", "eagle", "feast", "giant", "happy", "icily", "jelly", "knife", "lunch", "mango", "noble", "olive", "peace", "quick", "roast", "scale", "trick", "urban", "value", "wheat", "yield", "amber", "blend", "cabin", "dealt", "enjoy", "fraud", "glide", "honey", "issue", "jolly", "kneel", "latch", "medal", "nerve", "orbit", "pleat", "quake", "relay", "scoop", "trust", "unite", "voter", "witty", "xenon", "youth", "zesty", "alert", "brisk", "crane", "doubt", "equip", "flick", "grill", "haste", "input", "jumps", "koala", "liver" ] print(words[-1]) for i in range(10): print(random.choice(words))
#jimiah marshall #We are going to create a word guessing game. #The game selects a random word form a list of words. #The game then gives 3 letters as clues as to what the word is in the correct position. #The player has 5 chances to guess each word. #Each word the player guesses correctly he gets a point. #If he misses all five chances it moves to the nex word. #The total number of words selected in each game is 10. #At the end of the game the player gets a total score. importrandom simple_words = [ "print", "input", "if", "else", "elif", "for", "while", "break", "continue", "def", "return", "import", "from", "as", "pass", "in", "not", "and", "or", "is", "True", "False", "None", "int", "float", "str", "bool", "list", "tuple", "dict", "set", "len", "type", "open", "read", "write", "close", "with", "try", "except", "finally", "raise", "assert", "global", "nonlocal", "lambda", "range", "sum", "min", "max", "abs", "round", "sorted", "reversed", "append", "pop", "insert", "remove", "index", "count", "clear", "extend", "join", "split", "replace", "strip", "format", "enumerate", "zip", "map", "filter", "any", "all", "dir", "help", "eval", "exec", "bin", "hex", "oct", "id", "chr", "ord", "add", "subtract", "multiply", "divide", "equal", "less", "greater", "true", "false", "yes", "no", "high", "low", "up", "down", "left", "right" ]
#Brianna Hunte (: #Activity #We are going to create a word guessing game. #The game selects a random word form a list of words. #The game then gives 3 letters as clues as to what the word is in the correct position. #The player has 5 chances to guess each word. #Each word the player guesses correctly he gets a point. #If he misses all five chances it moves to the nex word. #The total number of words selected in each game is 10. #At the end of the game the player gets a total score. import random words=[ "apple", "book", "cat", "dog", "elephant", "fish", "green", "house", "idea", "jump", "kite", "love", "moon", "night", "open", "play", "quick", "run", "sun", "tree", "under", "voice", "water", "xylophone", "yellow", "zoo", "ball", "chair", "desk", "egg", "fun", "grow", "hand", "ice", "joy", "king", "lamp", "mouse", "nose", "orange", "purple", "queen", "red", "sing", "train", "umbrella", "van", "win", "box", "year", "act", "brave", "cold", "dance", "eat", "fast", "game", "help", "iron", "jam", "kind", "laugh", "make", "name", "park", "quiet", "read", "sleep", "talk", "use", "visit", "wait", "x-ray", "young", "zip", "bake", "climb", "draw", "enjoy", "fly", "grab", "hit", "invite", "joke", "kick", "listen", "move", "need", "order", "paint", "quit", "rest", "smile", "think", "understand", "vote", "walk", "yawn", "zoom", "nest" ]
#symiah andrews input random english_words = [ "apple", "banana", "cat", "dog", "elephant", "fish", "grape", "house", "ice", "jungle", "kite", "lion", "monkey", "night", "orange", "pencil", "queen", "rabbit", "sun", "tree", "umbrella", "vase", "water", "xylophone", "yogurt", "zebra", "ant", "book", "cloud", "dance", "eagle", "flower", "garden", "hat", "island", "juice", "kangaroo", "lamp", "mountain", "nest", "ocean", "pizza", "quiet", "road", "snake", "train", "under", "violin", "window", "x-ray", "yellow", "zoo", "air", "ball", "car", "drum", "egg", "frog", "goal", "hill", "ink", "jam", "king", "leaf", "moon", "net", "owl", "pen", "quilt", "ring", "star", "table", "up", "van", "wheel", "xenon", "year", "zip", "actor", "brave", "clown", "doll", "earth", "fast", "gift", "hero", "idea", "joke", "kind", "love", "music", "nurse", "open", "party", "quick", "red", "snow", "talk", "unit", "visit", "win" ]
#Gabrielle King #Activity #We are going to create a word guessing game. #The game selects a random word form a list of words. #The game then gives 3 letters as clues as to what the word is in the correct position. #The player has 5 chances to guess each word. #Each word the player guesses correctly he gets a point. #If he misses all five chances it moves to the nex word. #The total number of words selected in each game is 10. #At the end of the game the player gets a total score. import random simple_words = [ "sun", "water", "tree", "house", "friend", "happy", "blue", "small", "big", "run", "jump", "eat", "sleep", "walk", "talk", "car", "book", "game", "music", "color", "shape", "number", "time", "day", "night", "light", "dark", "hot", "cold", "loud", "quiet", "fast", "slow", "good", "bad", "new", "old", "easy", "hard", "open", "close", "up", "down", "left", "right", "front", "back", "here", "there", "yes", "no", "maybe", "please", "thank", "sorry", "hello", "goodbye", "today", "tomorrow", "yesterday", "always", "never", "often", "sometimes", "again", "more", "less", "same", "different", "first", "last", "one", "two", "three", "many", "few", "all", "some", "none", "round", "square", "long", "short", "tall", "little", "pretty", "ugly", "rich", "poor", "sick", "well", "strong" for i in range(10): print(random.choice)
#annayah vincen #Activity #We are going to create a word guessing game. #The game selects a random word form a list of words. #The game then gives 3 letters as clues as to what the word is in the correct position. #The player has 5 chances to guess each word. #Each word the player guesses correctly he gets a point. #If he misses all five chances it moves to the nex word. #The total number of words selected in each game is 10. #At the end of the game the player gets a total score. import random simple_words = [ "apple", "ball", "cat", "dog", "egg", "fish", "go", "hat", "ice", "jam", "kite", "lion", "man", "net", "owl", "pen", "queen", "rat", "sun", "top", "up", "van", "win", "box", "yes", "zoo", "ant", "bed", "car", "dot", "ear", "fan", "gum", "hill", "ink", "jar", "key", "log", "map", "nap", "oak", "pan", "quiz", "red", "sip", "tag", "use", "vet", "wax", "yak", "zip", "arm", "bag", "cow", "dig", "elf", "fix", "gap", "hop", "ice", "job", "kit", "lap", "mud", "net", "oil", "pop", "run", "sit", "tin", "urn", "vase", "web", "axe", "yarn", "zinc", "act", "bin", "cup", "dry", "eat", "fig", "gas", "hat", "ill", "jam", "kid", "leg", "man", "nod", "oak", "pit", "rag", "sky", "toy", "up", "van", "wig", "yam", "zip" ] print(simple_words[-1])
#ashanta thomas
#Activity #We are going to create a word guessing game. #The game selects a random word form a list of words. #The game then gives 3 letters as clues as to what the word is in the correct position. #The player has 5 chances to guess each word. #Each word the player guesses correctly he gets a point. #If he misses all five chances it moves to the nex word. #The total number of words selected in each game is 10. #At the end of the game the player gets a total score. import random words = ["apple", "baker", "chair", "dance", "eagle", "flame", "grape", "heart", "ivory", "jelly", "knife", "lemon", "magic", "night", "ocean", "plant", "quiet", "river", "stone", "tiger", "umbra", "vivid", "waltz", "xenon", "yield", "zebra", "brush", "cloud", "dream", "earth", "feast", "glide", "haste", "image", "jolly", "koala", "latch", "mirth", "noble", "orbit", "pearl", "quilt", "robin", "scale", "trail", "urban", "vapor", "whale", "xerox", "yacht"] for i in range(9): print(random.choice(words))
Examples
#line1 while True: #line2 item = input("Enter an item to add to the shopping list (or type 'done' to finish): ") #line3 if item.lower() == 'done': #line4 break #line5 if item in shopping_list: #line6 print(f"{item} is already on the list.") #line7 else: #line8 shopping_list.append(item) #line9 print(f"Added {item} to the list.") #line10 print("\nYour Shopping List:") #line11 for item in shopping_list: #line12 print("-", item) #Activity #We are going to create a word guessing game. #The game selects a random word form a list of words. #The game then gives 3 letters as clues as to what the word is in the correct position. #The player has 5 chances to guess each word. #Each word the player guesses correctly he gets a point. #If he misses all five chances it moves to the nex word. #The total number of words selected in each game is 10. #At the end of the game the player gets a total score.
Lists
A list in Python is an ordered, mutable (changeable), and indexed collection of items.
Lists can contain any data type (e.g., int, str, list, dict, etc.).
Lists are dynamic (can grow or shrink in size).
Lists are defined using square brackets [].
Lists are created using square brackets [ ], and items inside the list are separated by commas.
fruits = ["Apple", "Banana", "Cherry"] numbers = [1, 2, 3, 4, 5] mixed = ["Hello", 42, True] # A list can have different types of data!
You can pick items from the list using their position (index). Remember, Python starts counting from 0!
friends = ["Jake", "Emma", "Liam", "Sophia"] print(friends[0]) # Prints "Jake" print(friends[2]) # Prints "Liam"
You can update a list item like this:
fruits = ["Apple", "Banana", "Cherry"] fruits[1] = "Orange" # Changing "Banana" to "Orange" print(fruits) # Output: ['Apple', 'Orange', 'Cherry']
Use .append() to add an item at the end:
movies = ["Avatar", "Titanic"] movies.append("Inception") print(movies) # Output: ['Avatar', 'Titanic', 'Inception']
Use .insert() to add an item at a specific position:
movies.insert(1, "Avengers") print(movies) # Output: ['Avatar', 'Avengers', 'Titanic', 'Inception']
Use .remove() to delete a specific item:
colors = ["Red", "Blue", "Green"] colors.remove("Blue") print(colors) # Output: ['Red', 'Green']
Use .pop() to remove an item by index (or the last item if no index is given):
colors.pop(1) # Removes "Blue" (index 1) print(colors)
If you want to go through all items in a list, use a for loop:
games = ["Minecraft", "Fortnite", "Roblox", "Among Us"] for game in games: print(game)
In the code above games is a list and each item in the list of games goes into the variable game that is created. It holds the value of the first item in the list the first time through the loop until it holds the last item and then exits the loop.
You can use this to loop if you want to do something with each loop item example printing it or
thislist = ["apple", "banana", "cherry"] for i in range(len(thislist)): print(thislist[i])
Use above to loop through the list if you need to use the index
Use the in keyword:
games = ["Minecraft", "Fortnite", "Roblox", "Among Us"] if "Minecraft" in games: print("You love Minecraft!")
games = ["Minecraft", "Fortnite", "Roblox", "Among Us"] #You can also check whether something is not in a list if "Tetris" not in games: #This print statement will execute because Tetris is not in games print("You don't love Tetris!")
Want to put your list in order? Use .sort().
numbers = [5, 2, 9, 1, 3] numbers.sort() # Sorts from smallest to largest print(numbers) # Output: [1, 2, 3, 5, 9]
myList = [] myList.append("apples") myList.append(2) myList.append(3.5)
Functions
What is a Function?
In programming, a function is a reusable block of code designed to perform a specific task. Instead of writing the same code multiple times, you can define a function once and call it whenever needed. The code in the function doesn't run unless the function is called in your program.
In video games, functions are widely used for actions like attacking, healing, jumping, or calculating scores.
Why Use Functions?
- Reusability: Write the code once and reuse it multiple times. A player needs to heal, attack, or run. Instead of writing the same code repeatedly, use functions for each action.
- Readability: Break down complex logic into smaller, manageable pieces.
- Maintainability: Easier to update and debug specific parts of the code.
- Organization: Group related logic together for better clarity.
How to Define a Functionss
- Define the Function: Use the def keyword in Python.
- Give the function a name
- Open and close brackets
- Use the colon after the brackets
- Write the code that you want to execute when the function is called(used)
- Call the Function: Use the function's name followed by parentheses.
def greet(): print("Hello, welcome to Python!")
Once a function is defined, you can call (invoke) it by using its name followed by parentheses.
greet()
#function definition def greet(name): print(f"Hello, {name}!") #Calling the function greet("Alice") # Calling the function with the argument "Alice" greet("Bob") # Calling the function with the argument "Bob"
A function can take multiple parameters. Just separate them with commas inside the parentheses.
def add(a, b): result = a + b print(f"The sum of {a} and {b} is {result}")
Calling function
add(5, 3)
Make sure you have the variables in the correct order correct when calling the function. Also make sure the number of parameters in the definition and the number of arguments in the function call are the same.
You can give parameters default values, which are used if no argument is provided when the function is called.
def greet(name="Guest"): print(f"Hello, {name}!")
You can call with arguments or without arguments
greet("Alice") # Hello, Alice! greet() # Hello, Guest!
This Function Returns a Boolean.
def is_even(number): """This function checks if a number is even and returns True/False.""" return number % 2 == 0 # Calling the function print(is_even(4)) # Output: True print(is_even(5)) # Output: False
Function Returns a String
def greet(name): """This function returns a greeting message.""" return f"Hello, {name}! Welcome to Python." # Calling the function message = greet("Alice") print(message) # Output: Hello, Alice! Welcome to Python.
Functions can return any of the data types including dictionaries, lists, strings, etc. Lists are a great way to return multiple values.
Loops
Loops are a powerful way to repeat tasks in Python, enabling efficient data processing and iteration.
While Loop
What is a while loop?
The while loop repeats a block of code as long as a specified condition is true. You must be careful to avoid infinite loops by ensuring that the loop's condition eventually becomes false.
Example:counting down with a while loop
count = 5 while count > 0: print(count) count -= 1Output:
5 4 3 2 1
Essential Tip: Always Initialize Variable You will be testing before entering the loop. And make sure this variable will change in the loop body so that eventually it will be false and the loop will stop otherwise you will have an infinite loop. Which will eventually crash your program.
By using True a literal. This value will not change and the loop will go on forever.
while True: print("Hello")
Whenever you have an infinite loop you must always have a condition that checks a variable and if that variable is true then you use a break statement
#Some use this instead of ininite Loop running = True while running: print("Something") #They will have some code in the loop that will set running to false # based on the checking of a variable or some type of input or interaction from #the users(example clicking the exit button (x) or using the input and checking to see whether user chose a particular option). #There will be some sort of if statement to check the user's input and if that is true then there will be a break #statement inside of the if statement.
The for loop is used to iterate over a sequence, such as a list, tuple, dictionary, string, or a range of numbers. In each iteration, the loop variable takes the next value from the sequence.
# Loop from 0 to 4. Goes through the loop 5 times. When i is 0, 1, 2, 3, 4 #Loops from 0 to 4. 5 is not included. for i in range(5): print(i)
You can also specify start, stop, and step for the range:
# Loop from 2 to 10, stepping by 2. Up to 11 but not including 11 for i in range(2, 11, 2): print(i)
Loop Control Statements
- break: Exits the loop immediately.
- continue: Skips the current iteration and moves to the next.
Example with Break:
for i in range(10): if i == 5: break print(i)Output:
0 1 2 3 4
Example with Continue:
for i in range(5): if i == 2: #It will not print when i is 2 as the continue statement will cause it to skip that step and go on to when i becomes 3. continue print(i)
You can have a for loop inside of another for loop and a while loop inside of a while loop or for loop iside of while loop and vice versa.
# Example: Printing a multiplication table using nested while loops i = 1 while i <= 3: # Outer while loop j = 1 while j <= 3: # Inner while loop print(f"{i} * {j} = {i * j}") j += 1 i += 1 print("------")
# Define a list of strings words = ["Hello", "World", "Python"] # Nested for loop to iterate over each character in each string for word in words: # Outer loop iterates over words (strings) for char in word: # Inner loop iterates over characters in the word print(char, end=" ") # Print characters in the same line with spaces print() # Move to a new line after each word
Each outer loop iteration picks a string, and the inner loop iterates through each character in that string.
word = "Hello" for letter in word: print(letter) #Will print each individual letter 1 character at a time on its own line.
- Use a for loop or while loop to print numbers from 1 to 10.
- Input: n
- Output: Sum of all numbers from 1 to n.
- Input: n
- Output: Print multiplication table for n (e.g., n x 1 to n x 10).
- Input: "hello"
- Output: "olleh"
Print numbers 1 to 10
Sum of numbers from 1 to n
Multiplication table
Reverse a string
Dictionaries
A dictionary (dict) in Python is an unordered, mutable, and indexed collection of key-value pairs.
Keys must be unique and immutable (e.g., str, int, tuple).
Values can be of any data type (e.g., int, str, list, even another dict).
person = {"name": "Bob", "age": 30} #You can also create an empty dictionary and add values later on: empty_dict = {}
#Raises KeyError if the key doesn’t exist. #Using Square Brackets [] student = {"name": "Alice", "age": 21} print(student["name"]) # Output: "Alice"
Using .get() Safer as you don't key error
print(student.get("name")) # Output: "Alice" print(student.get("grade")) # Output: None (instead of KeyError) print(student.get("grade", "N/A")) # Output: "N/A" (default value). #In the last example the value on the right side of the comma you can #use as a default value if they key doesn't exist. It will create both the #key and the value.
Adding a Key Value Pair
student = {"name": "Alice"} student["age"] = 21 # Adds new key "age" student["name"] = "Bob" # Updates "name"
Using .update()(Multiple Updates)
student.update({"name": "Charlie", "age": 22, "grade": "A"})
Deleting Items
del student["age"] # Removes "age" key (raises KeyError if missing) age = student.pop("age") # Removes and returns value (safer) student.clear() # Empties the dictionary
.keys() Returns all keys
.values() Returns all values
.items() Returns key-value pairs as tuples
.copy() Creates a shallow copy. Create copy when don't want to change original.
.popitem() Removes & returns last inserted item (Python 3.7+)
Code Examples using methods
student = {"name": "Alice", "age": 21} print(student.keys()) # Output: dict_keys(['name', 'age']) print(student.values()) # Output: dict_values(['Alice', 21]) print(student.items()) # Output: dict_items([('name', 'Alice'), ('age', 21)]) for key, value in student.items(): print(f"{key}: {value}")
Dictionaries can contain other dictionaries.
employees = { "emp1": {"name": "Alice", "age": 25}, "emp2": {"name": "Bob", "age": 30} } print(employees["emp1"]["name"]) # Output: "Alice
Values can be of any data type (e.g., int, str, list, even another dict).
#Looping through keys and can get the item using the key for key in d: print(d["key"]) #Items returns the key value pairs in a tuple which we do something with in the loop for key, val in d.items(): print(key, ": ", val)
d = {"a": 1, "b": 2} "a" in d #Will return true if this key is in the dictionary
text = "apple banana apple orange banana apple" words = text.split() frequency = {} for word in words: frequency[word] = frequency.get(word, 0) + 1 print(frequency) # Output: {'apple': 3, 'banana': 2, 'orange': 1}
Modules
A module in Python is a file containing Python code (functions, classes, variables) that can be reused in other programs.
Modules help in organizing code into logical units.
They prevent naming conflicts and improve code reusability.
Example:
A file named math_operations.py can be a module containing math functions.
Another file can import and use these functions.
Types of Modules:
Built-in Modules (Pre-installed with Python)
Examples:- math (mathematical functions)
- random (random number generation)
- datetime (date and time handling)
- os (operating system interactions)
User defined Module
Third-party Modules (Installed via pip)
Another file can import and use these functions.
Import an Entire Module
#When import an entire module this way every function, object, class or variable you use has to have the module name and . before it. import math print(math.sqrt(16)) # Output: 4.0. sqrt is a function in the math module.
Import Specific Functions or Varibles
#When importing using this method you don't need to use module name followed by . #You can just use variable name or function name class name or object name directly from math import sqrt, pi print(sqrt(25)) # Output: 5.0 print(pi) # Output: 3.141592653589793
Import with an alias
import numpy as np #I have given numpy an alias(nickname). That I can use instead of numpy in my program print(np.array([1, 2, 3])) # Output: [1 2 3]
- Create a .py file (e.g., calculator.py).
- Define functions/variables inside it.
- Import it in another script.
#Saved in our module file called calculator.py def add(a, b): return a + b def subtract(a, b): return a - b
#Our main file saved as main.py import calculator #How we import the calculator.py file with its functions print(calculator.add(5, 3)) # Output: 8 print(calculator.subtract(5, 3)) # Output: 2
# In my_module.py def test(): print("This is a test.") if __name__ == "__main__": test() # Runs only when executed directly
Tuples
A tuple in Python is an immutable (unchangeable) and ordered collection of elements. Tuples are similar to lists but with one key difference: they cannot be modified after creation.
my_tuple = (1, 2, 3, 4, 5) print(my_tuple) # Output: (1, 2, 3, 4, 5)
#To create a tuple with one element, include a trailing comma. single_element_tuple = (10,) # Comma is necessary! not_a_tuple = (10) # This is just an integer
numbers = (10, 20, 30, 40, 50) # Access elements by index print(numbers[0]) # Output: 10 print(numbers[-1]) # Output: 50 (Last element) # Slicing a tuple print(numbers[1:4]) # Output: (20, 30, 40)
a = (1, 2, 3) b = (4, 5, 6) print(a + b) # Output: (1, 2, 3, 4, 5, 6) print(a * 2) # Output: (1, 2, 3, 1, 2, 3)
fruits = ("apple", "banana", "cherry") print("banana" in fruits) # Output: True print("grape" not in fruits) # Output: True
numbers = (5, 10, 15, 20) print(len(numbers)) # Output: 4 print(max(numbers)) # Output: 20 print(min(numbers)) # Output: 5
# Packing person = ("Alice", 25, "Engineer") # Unpacking name, age, profession = person print(name) # Output: Alice print(age) # Output: 25 print(profession) # Output: Engineer
my_tuple = (1, 2, 3, 2, 4, 2) print(my_tuple.count(2)) # Output: 3 (Counts occurrences of 2) print(my_tuple.index(3)) # Output: 2 (Index of first occurrence of 3)
#Unpacking 3 elements with only 2 variables a = (3, 5, 6) #b will take the first value and c will take whatever is left 5,6 in this case b, *c = a #c becomes a list with 2 values 5,6 while b is an integer variable. print(type(c))
Conditionals
Conditionals allow a program to make decisions based on certain conditions. In Python, we use if, elif, and else statements to control the flow of execution.
The if statement executes a block of code only if the condition is True.
age = 18 if age >= 18: print("You are eligible to vote.") # Output: You are eligible to vote.
The else block executes when the if condition is False.
temperature = 15 if temperature > 20: print("It's warm outside.") else: print("It's cold outside.") # Output: It's cold outside.
Use elif (short for else if) to check multiple conditions.
marks = 85 if marks >= 90: print("Grade: A") elif marks >= 75: print("Grade: B") elif marks >= 60: print("Grade: C") else: print("Grade: F") # Output: Grade: B
An if statement inside another if statement is called a nested if.
num = 10 if num > 0: print("Positive number") if num % 2 == 0: print("Even number") # Output: # Positive number # Even number
Python provides logical operators to combine multiple conditions:
and → Both conditions must be True.
or → At least one condition must be True.
not → Reverses the condition.
age = 25 has_id = True if age >= 18 and has_id: print("Access granted") # Output: Access granted if age < 18 or not has_id: print("Access denied")
Variables
In programming, a variable stores information (data) that your program can use and change. A variable is like a labeled box that holds something — you can open it, read it, or replace what’s inside.
name = "Alice" age = 25 is_student = True pi = 3.142
variable = 3 + 4 #Addition variable2 = 3 * 4 #Multiplication variable3 = 4 / 3 #Division remainder = 3 % 2 #Will give the remainder of
variableA = "Harry" variableB = variableA #variableB now has "Harry". They both have the string "Harry"
variable1 = "2" variableNumber = int(variable1) integer1 = 2 floatNumber = float(integer1)
#This is a comment x = 3 #Can also have a comment at the end of a statement
Strings
Conditionals allow a program to make decisions based on certain conditions. In Python, we use if, elif, and else statements to control the flow of execution.