230,891 views
8 votes
8 votes
7.2 code practice edhesive

User Georgij
by
2.9k points

2 Answers

16 votes
16 votes

Answer:

Step-by-step explanation:

got a 100

7.2 code practice edhesive-example-1
User Renatta
by
2.5k points
18 votes
18 votes

The python program method code and its description can be defined as follows:

Python code:

def ilovepython():#defining the method ilovepython

for i in range(0,3):#defining a loop that prints value 3 times

print ("I love Python")#print message

ilovepython()#calling the method

Output:

Please find the attached file.

Code Explanation:

  • Defining the method "ilovepython".
  • Inside the method, a for loop is declared that uses the range method in which it prints the value 3 times.
  • Inside the loop, a print method is used that prints the message value that is "I love Python".
  • Outside the method, method "ilovepython" is called that prints the given message value 3 times.

Find out more about the loop here:

7.2 code practice edhesive-example-1
7.2 code practice edhesive-example-2
User Lempkin
by
3.4k points