Answered step by step
Verified Expert Solution
Link Copied!

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
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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

Will you be able to pay your bills?

Answered: 1 week ago

Question

2 To what extent does their relevance vary internationally?

Answered: 1 week ago

Question

8 What can HRM do to manage diversity?

Answered: 1 week ago

Question

7 How should HRM practitioners approach conflict in the workplace?

Answered: 1 week ago