Discover a world of knowledge at Westonci.ca, where experts and enthusiasts come together to answer your questions. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

CALLING ALL COMPUTER SCIENCE LOVERS!!!!!!!
Can somebody please help me write a code that has the following requirements? If you cannot answer comment your code. TTHHHHHHHHAAAANNNNNNNNNK YOOOOOOOOOUU!!!!!!!!!!!!!!!!!!

Tracy will draw a picture using python.
(IT MUST BE CREATIVE)

1. for loops (at least 1)

2. Descriptive comments

3. variables (at least 2)

4. function (at least 1)

5. parameter (at least 1)

6. if or if/else (at least 1)

7. user input ( optional) ( + 2 bonus points)


Sagot :

Answer:

# Instead of repeating code over and over

forward(10)

left(90)

forward(10)

left(90)

forward(10)

left(90)

forward(10)

left(90)

# Use a for loop to repeat the code!

for i in range(4):

   forward(10)

   left(90)

# You can use the i variable inside the loop

# i starts at 0, and goes up to COUNT-1

# This will make Tracy move forward 0, then 1, then 2

for i in range(3):

   forward(i)

# You can change the value of i inside a for loop by using mathematical expressions

for i in range(3):

   forward(i*10)

# You can also control the value of i by using extended parameters

for i in range(STARTING_VALUE, ENDING_VALUE, INCREMENT):

# This will move Tracy forward 25, 50, and 75 pixels

for i in range(25, 76, 25):

   forward(i)

love you guys <3