Author Archives: Rifat Bhuiyan

Turtle graphics

 

Description:

This project is about  turtle forward a random distance between 0 and 150 pixels and 45 angle in red background. it make line randomly. HERE IS CODE FOR THIS PROJECT:

import turtle
import random

t = turtle.Turtle()
r = random.Random()

window = turtle.Screen()

window.bgcolor(‘red’)                                 # it’s for screen color.
t.pencolor(‘white’)                                        #it’s for pen color.

for x in range(100):                                        #range for x
angle = random.randint(0,45)
t.right(angle)                                                     # for angle
distance = random.randint(0,150)
t.forward (distance)
t.backward (distance)
distance = random.randint(0,150)
t.forward (distance)
t.backward (distance)
distance = random.randint(0,150)
t.forward (distance)
t.backward (distance)

 

Guess the number game

import random
randomNumber = random.randrange(0,100)
guessed = False
while guessed==False:
userInput = int(input(“Your guess please: “))
if userInput==randomNumber:
guessed = True
print(“congratulate”)
elif userInput>100:
print(“Our guess range is between 0 and 100, please try a bit lower”)
elif userInput<0:
print(“Our guess range is between 0 and 100, please try a bit higher”)
elif userInput>randomNumber:
print(“Try one more time, a bit lower”)
elif userInput < randomNumber:
print(“Try one more time, a bit higher”)

 

Description:

This is a guess game made by python program. Every time a user guess a number, If the user’s guess is higher that the random number the program should display “Too high, please try again.” and if it is lower that it will print too low and when user guess number matched with random number it will say congratulate.

Welcome!

This is the first post on your Learning Blog. Edit or delete it, then start blogging!

The ePortfolio is both a Learning Blog and an Academic Career Portfolio. Use the Learning Blog to document your learning experiences and class assignments each semester. As time goes by, add content to the Academics and Career sections to show your department, graduate institutions, or future employers how well prepared you are for your chosen career.

NOTE: Remember to add appropriate Categories and Tags to your posts. This will help your professors and other visitors find the content they are looking for. The Categories “Coursework” and “Field Trips” and the Tags “OpenLab” and “City Tech” have already been applied to this post. Feel free to make changes!