Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello All, I am working on a number guessing python project and I want to know the sample code of this project. Basically this project to guess the number after getting a few hints from the computer. So, the system will generate a number from 0 to 200 and ask the user to guess it after a clue. Every time a user gives a wrong answer, another hint pops up to make it easier for them. I have checked one source code from here and want to know this code size is good? import random #bring in the random number import time number=random.randint(1, 200) #pick the number between 1 and 200 def intro(): print("May I ask you for your name?") name=input() #asks for the name print(name + ", we are going to play a game. I am thinking of a number between 1 and 200") time.sleep(.5) print("Go ahead. Guess!") def pick(): guessesTaken = 0 while guessesTaken < 6: #if the number of guesses is less than 6 time.sleep(.25) enter=input("Guess: ") #inserts the place to enter guess try: #check if a number was entered guess = int(enter) #stores the guess as an integer instead of a string if guess<=200 and guess>=1: #if they are in range guessesTaken=guessesTaken+1 #adds one guess each time the player is wrong if guessesTaken<6: if guess<number: print("The guess of the number that you have entered is too low") if guess>number: print("The guess of the number that you have entered is too high") if guess != number: time.sleep(.5) print("Try Again!") if guess==number: break #if the guess is right, then we are going to jump out of the while block if guess>200 or guess<1: #if they aren't in the range print("Silly Goose! That number isn't in the range!") time.sleep(.25) print("Please enter a number between 1 and 200") except: #if a number wasn't entered print("I don't think that "+enter+" is a number. Sorry") if guess == number: guessesTaken = str(guessesTaken) print('Good job, ' + name + '! You guessed my number in ' + guessesTaken + ' guesses!') if guess != number: print('Nope. The number I was thinking of was ' + str(number)) playagain="yes" while playagain=="yes" or playagain=="y" or playagain=="Yes": intro() pick() print("Do you want to play again?") playagain=input()
  2. Hello All, I am new in this community and I am in my learning face, I want to know about CSS opacity, As my research and according to this post CSS opacity is the property used to describe the transparency of an element but I have gave this answer in my previous interview and interviewer not satisfied with this. Can anyone suggest me exact meaning and working of CSS opacity?
  • Create New...