Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

include all your solutions in a single .py file. When the code is executed, the following message should appear before start of each task. There

include all your solutions in a single .py file. When the code is executed, the following message should appear before start of each task. There should be two blank lines before and after this message. Press any key to start Task n, where n is the task number (1, 2, 3 or 4)

import turtle #get input from user radius = int(input("Enter Radius:"))

# initilize turtle myT = turtle.Turtle() #set pensize to 5 myT.pensize(5)

# draw circles myT.color("green") myT.circle(radius)

myT.penup() myT.setposition(-((radius+(radius/5))*2), 0) myT.pendown() myT.color("yellow") myT.circle(radius)

myT.penup() myT.setposition((radius+(radius/5)),(radius+(radius/5))) myT.pendown() myT.color("red") myT.circle(radius)

myT.penup() myT.setposition(-(radius+(radius/5)), (radius+(radius/5))) myT.pendown() myT.color("black") myT.circle(radius)

myT.penup() myT.setposition(-(radius+(radius/5))*3, (radius+(radius/5))) myT.pendown() myT.color("blue") myT.circle(radius)

# hide turtle myT.hideturtle()

from random import randint

def get_random_number(n): num = '' for i in range(n): num += str(randint(0, 9)) return num

def num_matched(num, guess): count = 0 for i in range(len(num)): if num[i] == guess[i]: count += 1 return count

def main(): rand_num = get_random_number(4) num_guesses = 0 print('Welcome to the Guess Game!') while True: guess = input('Enter a number: ') count = num_matched(rand_num, guess) num_guesses += 1 if count == 4: break print('you have guessed %d digits in the correct position' % count) print('Congratulations. You correctly guessed the number.') print('You needed %d guesses to identify the correct number.' % num_guesses)

main()

def max3(num1,num2,num3): if(num1>num2 and num1>num3): return num1 elif(num2>num3): return num2 else: return num3

def main(): num1 = eval(input("Enter num1: ")) num2 = eval(input("Enter num2: ")) num3 = eval(input("Enter num3: ")) print(max3(num1,num2,num3))

main()

p = 15000 #principal t = 5 # time 5 years r = int(input('Enter interest rate ( type 0 when done): ')) while r > 0: i = p * t * r / 100; print("The interest is ", i) r = int(input('Enter interest rate ( type 0 when done): '))

all 4 code are listed above(if can you can also upload the complete py files and I will download it)

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

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

=+ f. instituting laws against driving while intoxicated

Answered: 1 week ago