22 May Aurora Wednesday Saturday Python Homework 20.05.20.
Question: Draw the following picture in the pygame window: (could be different color) Hint: using pygame.draw.circle ...
Question: Draw the following picture in the pygame window: (could be different color) Hint: using pygame.draw.circle ...
Question: Write a program to ask the user for five names. The program should store the names in a list, and print them all out at the end. It should look something like this: Sample input: Enter 5 names: Tony Paul Nick Michel Kevin Sample output: The names are Tony, Paul, Nick, Michel, Kevin Hint: You can use...
Question: Create a Student class and make the following methods to : __init__() – Initialize it with name and roll number. __str__() – Display all information of the student. setAge() – It should assign age to student. setMarks() – It should assign marks to the student. ...
Problem DescriptionA palindrome is a word which is the same when read forwards as it is when read backwards. For example, mom and anna are two palindromes. A word which has just one letter, such as a, is also a palindrome. Given a word, what is the longest palindrome that is contained...
Question: You are given a string . Suppose a character 'a' occurs consecutively n times in the string. Replace these consecutive occurrences of the character 'a' with (n, 'a') in the string. Input Format: A single line of input consisting of the string .Output Format: A single line...
Question: The student council at Central Canada Collegiate is preparing signs with the message WELCOME TO CCC GOOD LUCK TODAY on various walls around the school. A sign is wide enough to hold w characters on each row, including spaces, as befits the wall to be...
Question 1: Using split and join function of the list to change string "green,red,yellow,blue," into string: "green light* red light* yellow light* blue light* " Hint: >>> vegetables = "carrots, potatoes, onions, leeks, celery" >>> # string.split(separator) will split the string by separator, for example: >>> vegetables = vegetables.split(", ") >>> print(vegetables) ['carrots', 'potatoes', 'onions',...
Question: Create a Student class and make the following methods to : __init__() – Initialize it with name and roll number. __str__() – Display all information of the student. setAge() – It should assign age to student. setMarks() – It should assign marks to the student. ...
Question: write a program to ask user about the date(year, month and day), then calculate the day of the year. Sample input: Year: 2016 Month: 6 Day: 23 Sample output: Day of the year: 175 Hint: You need consider leap years and non leap years, in order to do easier calculation, you may create...
Question 1: We have a list of following: zoo = [‘monkeys’, ‘tigers’, ‘pandas’, ‘penguins’, ‘giraffes’, ‘hippos’, ‘bears’] how to retrieve a slice of list zoo, so you can get the following result? [‘monkeys’, ‘pandas’, ‘giraffes’, ‘bears’] Question 2: from the same list of zoo in the question 1, how to retrieve a slice...