-3

I am trying to make a guess the number game in python.

print("I am thinking of a number between" + lowerboundnumber +" and" +greaterboundnumber)

lowerboundnumber = random.randint(1, 50)
greaterboundnumber = random.randit(51, 100)

How can I use my variables, lowerboundnumber and greaterboundnumber in a print function, without adding them? Sorry what I am trying to ask makes no sense. But any type of help would do

юля
  • 1
  • Are you trying to add them together and print the result, or you don't want to use `"string" + numbr +"string" + number` syntax when you print? – StarshipladDev May 19 '21 at 23:52
  • Also you are using random.randit instead of random.ranint on line 4 – StarshipladDev May 19 '21 at 23:53
  • Use a string formatting method. – Barmar May 19 '21 at 23:54
  • please add more information about what you want to do – dev55555 May 19 '21 at 23:54
  • As long as you don't use a math operation between the two ints, you should be able to print them – 12944qwerty May 19 '21 at 23:54
  • 1
    The code you've written doesn't try to add the two numbers. It will get an error because you can't add a string and an integer. – Barmar May 19 '21 at 23:55
  • 1
    Stack Overflow is not intended to replace existing documentation and tutorials. You need to repeat your tutorial materials on basic data types and on formatting output. I suspect that you simply need to look up the `str` conversion method ... which gets your question deleted as inappropriate for this site. – Prune May 19 '21 at 23:57

1 Answers1

0

You can use f-string formatting and make it quite a bit cleaner:

print(f"I am thinking of a number between {lowerboundnumber} and {greaterboundnumber}")

Sam Dolan
  • 31,966
  • 10
  • 88
  • 84