Print issues- syntax


#1



I need to put calculations for square, square root, etc.


It indicates I have improper syntax on my print function but I don't know why.


I expect there not to be an error message and to print the different values on the same line.


#Import math library
import math

# Initialize any necessary variables


# Prompt the user for the starting, ending and interval values
starting_int = (input('Enter starting integer: '))
ending_int = (input('Enter ending integer: '))
interval = int(input('Enter the interval (step) value: ')
               
# Create a for loop based on the values
# Print each value and calculate the results as specified
for y in range(starting_int, ending_int)
    print((y*y),math.sqrt(y),math.sin(y),math.cos(y),math.tan(y),math.log(y),math.log10(y), end="")
    y=y+interval


#2

why do you not cast starting_int and ending_int to integer?

look at the for loop, at the end there should be a colon


#3

I fixed the int problem. When I put a colon at the end of the for loop, it is marked as improper syntax.


#4

you put the colon at the end of the line at the for loop? I just reminded you what is missing, you still had to think about the placing

If you need more help, post an updated version of your code


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.