-2
name = input("what is your name? ")
age = int(input("what is your age? "))
year = str((2021 - age) + 100)

print(name , ", you'll be 100 in" , year , " !")

number = int(input("type in a number: "))
text = print('\n', name , ", you'll be 100 years old in" , year , " !")
x = 1

if x <= number:
   print(text)
if x <= number:
    x = x + 1
if x == number:

and the output should be:

number = 3

output:

text

text

text

After trying while loops and if statements I get:

number = 3

output:

text

[none]

[none]

namuHlaeR
  • 3
  • 3
  • https://stackoverflow.com/questions/27312273/meaning-of-end-in-the-statement-print-t-end#:~:text=The%20default%20value%20of%20end,%2B%22)%20will%20print%20hello%20%2B end='' –  Jan 17 '21 at 20:29

1 Answers1

0

This line is causing the issues:

text = print('\n', name , ", you'll be 100 years old in" , year , " !")

The return of a print() statement is None, so in that line text = None. Meaning, when you print text, you are printing None.

You can rewrite it like this:

text = f"\n{name}, you'll be 100 years old in {year}!"
print(text)
goalie1998
  • 1,427
  • 1
  • 9
  • 16