Write code that explores various data types and basic logical tasks in Python.
Requirements
1
.
Numbers
Create an integer
Create a float
Assign the value
“
1
5
.
0
”
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
2
.
Strings
(
5
%
)
•
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
3
.
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
4
.
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
5
.
Dictionaries
•
Research the dictionary data type in Python
•
Create a new dictionary
•
Print an item from the dictionary using its key
1
•
Change the value associated with a key
•
Add a new item to the dictionary
•
Show using code if the dictionary is iterable
6
.
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
.
7
.
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.
8
.
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
2
.
9
.
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
"
1
5
.
0
"
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
(
0
7
0
)
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
(
1
0
%
)
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
-
1
0
%
)
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
2
.
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 "15.0" 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
Write code that explores various data types and basic logical tasks in Python.
Requirements
1.Number5
Create an integer Create a float Assign the value 15.0 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 2. Strings 9%
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
3. Booleans)
Create a boolean variable with the value True Write a simple if statement that performs a block of code if the variable is Truea 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 aFalse, describe the result
4.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 5. Dictionaries (10%) Research the dictionary data type in Python Create a new dictionary Print an item from the dictionary using its key
1
Change the value associated with a key Add a new item to the dictionary Show using code if the dictionary is iterable 6.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. 7. Else If Statement(69)
Write an else if statement that checks a numerical grade against a letter grading scale The else if statement should print the proper grade.
8.For Loop7 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 2
9.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. PTY