No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
how could i make the function to do the colours red, yellow and green for 5 sec delays and make the loop keep on going? [code] def trafficLights(): win = GraphWin() red = Circle(Point(100, 50), 20) red.setFill("black") red.draw(win) amber = Circle(Point(100, 100), 20) amber.setFill("black") amber.draw(win) green = Circle(Point(100, 150), 20) … |
|
atlast I have managed to get some working code but the first problem is that I have is taht.. when I call draw(2,4) I have a column of 2 circles and 4 rows and I would actually like it to be a clomun of 2 and row of 4. Secodly … |
|
Can someone help me with this code.. I get an error when I try to execute it [code] from graphics import * def main(): colour = raw_input("Enter the colour: ") win = GraphWin("Patch", 200, 200) drawCircle(win, 50, 50, colour) def drawCircle(win, x, y, colour): for i in range(5): for j … |
|
I would like to be ablt to display 25 circles with alternating colours of red and white? But the code I produced does not work.. plz help. from graphics import * w = 300 h = 300 win = GraphWin("Red Circle", w, h) center = Point(150, 150) radius = 80 … |
|
can someone plz explain why each option is valid or invalid..i have no clue of waht is going on in these questions? all i can see are they are being multiplied?.. i do not understand these attributes and instances and cannot find any helpful resources either? i know in the … |
|
how could I make the function count?.. its a test marked out of 5, so if the user enters 1,1,2,2,4,5, then the output= 2 people got 1 mark, 2 people got 2 marks and 0 got 3 marks and so on?... i dnt knw if my code is even right.. … |
|
I need to have 4 functions which asks the user how many times to flip the coin and then displays the number of heads and the number of tails as a decimal? [code] def getInputs(): times=input("please enter the number of times the coin should be flipped: ") def simulateFlips(): for … |
|
how could i print the length of a parameter?.. like def length(word) gives the output "word 4"?.. I have no clue of what to do? def length(): len=length() |
|
How could i index the program to output e.g. displayDate(10, 2, 2009) gives "10 Feb 2009" as the output. [code] def displayDate(day, month, year): Months = ['Jan', 'Feb', 'March', 'April', 'May', 'June', 'July', 'August', 'Sept', 'October', 'December'] [/code] |
|
I need the function to be able to walk in all four directions with equal probabbility and return the distance away from the starting point. The function below only takes steps forwards and backwards? [code] def main(): numWalks, numSteps = getInputs() averageSteps = takeWalks(numWalks, numSteps) printExpectedDistance(averageSteps) def getInputs(): numWalks = … |
|
i am a bit stuck on this, i need to call the first 2 functions for the output in the 3rd one. The user has to should be able to continue until they want to stop converting and they should be asked on which way the conversion is to be … |
|
how could i double a number when clicked on in the graphics window?... this is for graphics.py and a line separating the two sides in the graphics window and on each click on either side it must go up by 2 until 12? i can only think of using a … |
|
how could i call the above function so that when i input something like 21 for the mark the ouput is "the grade is A", and when the user inputs something more than 25 and less than 0 hes asked to input it again..? [code] def mark2Grade(mark): if mark >=20: … |
|
I need the function to display a set of eyes, so if i call the function Eyes(3,4) a graphics window opens with exact dimesions for 4 coloumns and 2 rows of eyes... [code] from graphics import * def drawCircle(win, centre, radius, colour): circle = Circle(centre, radius) circle.setFill(colour) circle.setWidth(2) circle.draw(win) def … |
|
I need the function to display a square of numbers. This is the actual function. [code] def draw(n): for i in range(n+1): print i*(n) [/code] but if i call the function [code] def drawBlock(3): [/code] then the output should be 333 222 111 but i cant understand how to get … |
|
how could i square the result of function?.. so when i call the functioon [code] def sum(first, last): for i in range(first, last+1): print i return i**2 [/code] it gives the answer as 50, as it should square 3,4 and 5=50 |
|
The function below is supposed to ask the user to enter a choice of rock paper or sciessors and output an error mesage if the user enters an invalid choice and then ouput a message if they won, drew or lost against the computer. [code] def rockPaperScissors(): import random choice=raw_input("please … |
|
How could I call function by clicking in the graphics window. I currently have a draw eyes function but i want to be able to call it by clicking on the graphics window and call 30 eyes in the same colour sequence of blue, green and brown? so i could … |
|
I want to be able to move the iris and the pupil of the eye, if I click on the left of the graphic window irrsepective of high or low then it should move left and if i click on the right then if should move right. if i click … |
|
I have to get pthagaros to get the distance between 2 points. so the function distanceBetweenPoints(Point(1, 2), Point(4, 6)) should result in 5.0. the parameters are supposed to be P1, P2, which i think i have done?. The get an error when i try to execute this?.. help please def … |
|
I want to be able to output the area of the circle and the cirumference of the circle to the user. so the output is to be "the area of the circle is... and the circumference of the circle is..." and it has to be to 2dp. the question says … |