Python Forum
Having trouble with my Computer Science task
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Having trouble with my Computer Science task
#1
My computer science teacher doesn't know python, ive spent 20 minutes trying to figure this out but cannot.
This is my task

You are required to produce a simple guess the Number Game
Program should generate an integer within the range of 1 to 10
Player should guess the number
If the guess is wrong, your program should tell the player if the number guessed is smaller or greater than the number.
This should continue until the player makes a correct guess.
Finally, it awards the player with five stars if he/she gets it right the time, four stars if he/she gets it right the second time and three stars if he/she gets it right the third time.
Make it into Python code.

What I've done.
count=0
import random
i=random.randint(1,11)
 
 
 
while True:
    guess=input(int("Guess the number that was generated from 1-10"))
    if guess==i:
        while False:
    elif i<guess:
        print("The number is smaller")
        count=count+1
    elif:
        print("The number is greater")
        count=count+1
        
               
 
if count==1:
    print("You got 4 stars")
elif count>=2:
    print("You got 3 stars")
else count==0:
    print("you got 5 stars")
Yoriz write Oct-07-2021, 11:10 AM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Attached Files

Thumbnail(s)
   
Reply


Messages In This Thread
Having trouble with my Computer Science task - by Dunxx - Oct-07-2021, 11:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Computer science can you help me with the last part of the code after mentionedWords. shirleylam852 9 4,127 Nov-28-2020, 01:29 AM
Last Post: shirleylam852
  computer science coursework, read the text please and tell me if theres any specifics sixcray 4 2,655 Nov-11-2020, 03:17 PM
Last Post: buran

Forum Jump:

User Panel Messages

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