Python Forum
Converting pseudocode to Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting pseudocode to Python
#4
Okay here is my code

import random
number = random.randint(1000,9999)
print number
count_attempts = 0
answer_status = "incorrect"
while(answer_status == "incorrect"):
guess = input ("please guess number")
count_attempts = count_attempts + 1
if guess == number:
print ("well done. The number of attempts it took were")
print count_attempts
answer_status = "correct"
else:
print("number of digits correct")

I need to insert a function which allow me to say when I get the answer wrong it will print the number of digits from the number that i guessed were right. Any ideas?
Reply


Messages In This Thread
Converting pseudocode to Python - by qwertyK - Oct-24-2017, 10:14 AM
RE: Converting pseudocode to Python - by metulburr - Oct-24-2017, 10:18 AM
RE: Converting pseudocode to Python - by buran - Oct-24-2017, 10:18 AM
RE: Converting pseudocode to Python - by qwertyK - Oct-24-2017, 01:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Converting String to Integer Python Johnny1998 5 3,285 Aug-02-2019, 08:13 PM
Last Post: Johnny1998
  Can't figure out how to write the correct functions for my pseudocode mkrodick 2 2,817 Jul-30-2018, 12:30 PM
Last Post: ichabod801
  Problem writing code with my pseudocode MattWilk97 1 2,987 Aug-29-2017, 01:54 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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