Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write code that explores various data types and basic logical tasks in Python. Requirements 1 . Numbers Create an integer Create a float Assign the
Write code that explores various data types and basic logical tasks in Python.
Requirements
Numbers
Create an integer
Create a float
Assign the value
to a variable and force Python to interpret it as an integer rather than as a float
Experiment with adding, subtracting, multiplying, and dividing numbers
Strings
Create a string
Determine the length of the string, meaning how many characters are in the string
Print the fifth character in the string
Add new text to the end of the string
Create a new variable with a portion of the original string
Booleans
Create a boolean variable with the value
True
Write a simple if statement that performs a block of code if the variable is
True
Change the variable to
False
Write a simple if statement that performs a block of code if the variable is
False
Attempt to add two boolean variables together, use different combinations of
True
and
False
describe the result
Lists
Create a list with five items
Print the third item in the list
Add a new item to the list
Use a for loop and print each item in the list
Remove the third item from the list and use a for loop to print the items that remain
Change the first item in the list to a new entry
Dictionaries
Research the dictionary data type in Python
Create a new dictionary
Print an item from the dictionary using its key
Change the value associated with a key
Add a new item to the dictionary
Show using code if the dictionary is iterable
If Statement
Write an if statement that checks whether or not a numerical grade is an
A
If the grade is an
A
then print a statement indicating that it is
Else If Statements
Write an else if statement that checks a numerical grade against a letter grading scale.
The else if statement should print the proper grade.
For Loop
Create a list of numerical grades that contains at least five values.
Loop over the values in the list and feed each value into the else if statement from part
Function Write code that explores various data types and basic logical tasks in Python.
Requirements
Number
Create an integer
Create a float
Assign the value
to a variable and force Python to interpret it as an integer rather than
as a float
Experiment with adding, subtracting, multiplying, and dividing numbers
Strings
Create a string
Determine the length of the string, meaning how many characters are in the string
Print the fifth character in the string
Add new text to the end of the string
Create a new variable with a portion of the original string
Booleans
Create a boolean variable with the value "True"
Write a simple if statement that performs a block of code if the variable is "True"
Change the variable to "False"
Write a simple if statement that performs a block of code if the variable is "False"
Attempt to add two boolean variables together, use different combinations of "True" and "False",
describe the result
Lists aro
Create a list with five items
Print the third item in the list
Add a new item to the list
Use a for loop and print each item in the list
Remove the third item from the list and use a for loop to print the items that remain
Change the first item in the list to a new entry
Dictionaries
Research the dictionary data type in Python
Create a new dictionary
Print an item from the dictionary using its key
Change the value associated with a key
Add a new item to the dictionary
Show using code if the dictionary is iterable
If Statemen
Write an if statement that checks whether or not a numerical grade is an
A
If the grade is an
A
then print a statement indicating that it is
Else If Statement
Write an else if statement that checks a numerical grade against a letter grading scale.
The else if statement should print the proper grade.
For Loop
zurv
Create a list of numerical grades that contains at least five values.
Loop over the values in the list and feed each value into the else if statement from part
Function
Build a function that accepts a list of numerical grades as an input, checks each numerical grade
to determine its letter grade equivalent, and returns a list of letter grades.
Build a function that accepts a list of numerical grades as an input, checks each numerical grade to determine its letter grade equivalent, and returns a list of letter grades.
Provide code that tests this function against a list of numerical grades.Write code that explores various data types and basic logical tasks in Python.
Requirements
Number
Create an integer
Create a float
Assign the value to a variable and force Python to interpret it as an integer rather than
as a float
Experiment with adding, subtracting, multiplying, and dividing numbers
Strings
Create a string
Determine the length of the string, meaning how many characters are in the str
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started