75.9k views
3 votes
Edhesive Intro to CS Code Practice 1.8

I am pretty sure I got it right. But it keeps telling me that I have an EOF error on the E input.

User Crsuarezf
by
6.7k points

1 Answer

3 votes

Questions:

CS Code Practice 1.8 Question 1:

Write a code that accepts the user's age as an input, then print their age in 10 years.

CS Code Practice 1.8 Question 2:

Write a code that accepts a whole number as an input, subtracts 5 and print the answer

Answer:

Question 1:

currentage = int(input("Enter your age: "))

print("Your age in 10 years is "+str(currentage + 10))

Question 2:

userinput = int(input("Enter a whole number: "))

print(str(userinput)+" - "+str(5)+" = "+str(userinput - 5))

Step-by-step explanation:

There are two questions in this category and I don't know which of them you need; So, I answered both.

Question 1:

This line prompts user for age

currentage = int(input("Enter your age: "))

This line adds 10 to user input and prints the result

print("Your age in 10 years is "+str(currentage + 10))

Question 2:

This line prompts user for a whole number

userinput = int(input("Enter a whole number: "))

This line subtracts 5 from the whole number and prints the result

print(str(userinput)+" - "+str(5)+" = "+str(userinput - 5))

User Rgamber
by
5.4k points