Python Forum
Please Help with My First Python Attempt
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please Help with My First Python Attempt
#1
Write a program to simulate a simple guessing number game , specify how many guesses the user can do , and then ask them for a guess. Then it prints out Cold if his/her guess is greater or smaller than 40% of the answer, and print HOT if its within 10%.

who can help me pls
Reply
#2
Lots of people can help you, but it's homework, so you need to give it a try first. Take a bit of time to write what you can, and come back with something specific. As it is, you aren't saying what parts you can do and what parts need help with.
Reply
#3
I am try to solve this homework from 1 week
and whats is the wrong in this code
================================================
t = 7
print(t)

guess = int(input("Please enter your guess: "))

if guess == 7:
print("congratulation you win")
elif guess == int(range[1,6]):
print("Your guess is too low")
elif guess == int(range[6,9]):
print("hot")
else guess == int(range[9,11]):
print("cold")
Reply
#4
Write a program to simulate a simple guessing number game, specify how many guesses the user can do

You don't do this. For this you will want to use a loop, a while loop that counts each guess or a for loop with a range. Something like these:
number_of_guesses = 0
while number_of_guesses > 5:
    """game code goes here"""
    number_of_guesses += 1
 
or

for guess in range(5):
    """game code goes here"""
      
Then it prints out Cold if his/her guess is greater or smaller than 40% of the answer, and print HOT if its within 10%.

This is some arithmetic that is part of your assignment. Your code doesn't use percentages at all. You'll need to find 40% and 10% of the answer and the difference between the guess and the answer.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Please Help with My First Python Attempt saigwe 2 4,177 Jan-12-2021, 08:01 AM
Last Post: Safa999

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020