Respuesta :

Answer:

This chapter is about variables in Python. So a variable can be any data type. And to find the datatype of a variable we need to use below code:

x=10

print(type(x))

This will output: integer

Now we can covert a string into integer as below:

x=input("Enter X:")

But above x is considered as string, and we need to convert it to integer to make use in for loop or any calculation.

we can use:

int(x), and this will convert x to int from string.

Also, we have operators to change the variable values like =. +=, -=, /=, *= etc. So you need to remember these, and you will be up with all that is required for understanding variables. And rest is self explanatory certainly.

Explanation:

The answer is self explanatory.

Following are Python programs to the given the question:

Program Explanation:

  • Import package.
  • Defining a "grade" variable that inputs an integer value.
  • Defining a sleep method that accepts value in the parameter.
  • Using the conditional statement that checks the "grade" value and compares its value and prints its value.

Program:

import time as t#import package time

grade = int(input("Enter your grade in number in 9 to 11: "))#defining a variable grade that inputs integer value  

t. sleep(0.5) #calling sleep method  

if grade == 9: #using if to compare grade value equal to 9

   print("Freshman") # Freshman message#  

elif grade == 10:#using elif to compare grade value equal to 10  

   print("Sophomore")# Sophmore message#

elif grade == 11: #using elif to compare grade value equal to 11

   print("Junior") # Junior message#  

else: #defining else block

   print("Incorrect..") # Incorrect message #  

Output:

Please find the attached file.

Learn more:

brainly.com/question/19587441

Ver imagen codiepienagoya
Q&A Education