# Help with error

I’m doing a school project and I’m very new to python and haven’t done any coding before. I’m trying to do a simple loop where the user can repeat the program

# Print a welcome message that is appropriate for all patrons. Prompt the user to enter their Patron type

Print(“Hello science lovers! Want to learn about the unique environment of the beloved Emporer Penguin? Use this program to marvel in the ways the emporer penguin survises the harshness of its cold environment.”)
sk = float(input("Please enter your skill level (If you are a science rookie, enter 0, if you are a science enthusiest, enter 1): "))
#Print an introduction about Emperor penguins and this interactive program
print(“The Emporer Penguins live on the antarctic continent and are the largest known species of penguin. They are also the only bird that breeds during the antarctic winter, which forced them to adapt behaviours to survive the winter. These penguins breed in late April and May, and once the female penguin lays the egg she returns to sea around late May or early June.”)
print(“It is the male penguin’s responsibility to take care of this egg by placing it between their feet and folds in their skin. While incubating their egg, the male penguin must indure the very harsh conditions of an Antarctic winter.”)
#Print general message about winter temperatures
print(“In Antarctica, winter lasts from March to October with temperatures ranging from -2 degrees to -46 degrees Celsius. These temperatures will also vary throughout the day, although not significantly. It is due to these extreme temperatures that the male emperor penguin has adapted to have skin flaps between his feet so that the egg can stay warm.”)
user = 1

While user == 1:

``````#Prompt user to select a winter month

month = float(input("Let's take a look at the temperature fluctuations in one of these winter months. Please input a month from May to September: "))

#If user is enthusiest input a graph of fluctuations in temperature throughout chosen month
If sk = 1 and month = May:
print("Take a look at this graph of the temperature during your chosen month.")
X = arrange(0, 31)
Y = 21.5*sin(2*pi/(31/24)*(X-8)-23.5
plot(X, Y)
show()
If sk = 1 and month = June:
print("Take a look at this graph of the temperature during your chosen month.")
X = arrange(0, 30)
Y = 20*sin(2*pi/(30/24)*X)-25
plot(X, Y)
show()
If sk = 1 and month = July:
print("Take a look at this graph of the temperature during your chosen month.")
X = arrange(0, 31)
Y = 21*sin(2*pi/(31/24)*X)-25
plot(X, Y)
show()
If sk = 1 and month = August:
print("Take a look at this graph of the temperature during your chosen month.")
X = arrange(0, 31)
Y = 20*sin(2*pi/(31/24)*X)-24
plot(X, Y)
show()
If sk = 1 and month = September:
print("Take a look at this graph of the temperature during your chosen month.")
X = arrange(0, 30)
Y = 21.5*sin(2*pi/(30/24)*X)-24.5
plot(X, Y)
show()
#Prompt user to select date of month
t = float(input("Try typing in a date and our program will predict the temperature: "))
#Print message about predicted temp of that day
If month = May:
print("At this day on this month the temperature will be: ", 21.5*sin(2*pi/(31/24)*(t-8)-23.5, "degrees Celsius")

If month = June:
print("At this day on this month the temperature will be: ", 20*sin(2*pi/(30/24)*t)-25, "degrees Celsius")

If month = July:
print("At this day on this month the temperature will be: ", 21*sin(2*pi/(31/24)*t)-25, "degrees Celsius")

If month = August:
print("At this day on this month the temperature will be: ", 20*sin(2*pi/(31/24)*t)-24, "degrees Celsius")

If month = September:
print("At this day on this month the temperature will be: ", 21.5*sin(2*pi/(30/24)*t)-24.5, "degrees Celsius")

#Prompt user to enter time of day.
d = float(input("Try typing in a time on this particular date in hour increments and in 24 hour time: "))
#Calculate the temperature using the function winter_temp and print a useful message.
If month = May:
print("At this time on this day the temperature will be: ", 21.5*sin(2*pi/(31/24)*((t-8)+(d/24))-23.5, "degrees Celsius")

If month = June:
print("At this time on this day the temperature will be: ", 20*sin(2*pi/(30/24)*(t+(d/24))-25, "degrees Celsius")

If month = July:
print("At this time on this day the temperature will be: ", 21*sin(2*pi/(31/24)*(t+(d/24))-25, "degrees Celsius")

If month = August:
print("At this time on this day the temperature will be: ", 20*sin(2*pi/(31/24)*(t+(d/24))-24, "degrees Celsius")

If month = September:
print("At this time on this day the temperature will be: ", 21.5*sin(2*pi/(30/24)*(t+(d/24))-24.5, "degrees Celsius")

#Ask if user would like to try another month
user = float(input("Enter 1 to try another month, or 0 to continue: "))
``````

Else:
If repeat == 1:
#Print a useful message about wind chill.
wind_chill = 13.112 + 0.6215t − 11.37v0.16 + 0.3965t v0.16
print(“Wind chill makes the apparent temperature in the arctic seem much colder than it is. It adds to the intensity of the temperatures in Antarctica, which has lead to the multitude of heat maintaining adaptations that the emporer penguins have collected over time. Emporer penguin colonies see a wind speed at an average of 15km/h!”)
#Prompt the user to enter a wind speed.
v = float(input("Try entering a wind speed value to see what the apparent temperature will then be: "))
#Calculate the apparent temperature using wind_chill. Print a useful message.
print("With this wind speed, the apparent temperature will be: ", wind_chill, “degrees Celsius”)
#Ask the user if they want to choose another wind speed.
repeat = float(input("Enter 1 to choose another wind speed, or 0 to continue: "))
#Print a brief description of emperor penguin huddles. Qualitatively explain the basic effect of wind speed on the shape of a tight huddle.
If repeat == 0:
print(“In these harsh winters, the emporer penguins huddle in a large group to stay warm. This allows the penguins to not expend as much energy, as what they would if they were individually keeping themselves warm. The temperature inside a huddle can reach as much as 37 degrees celsius. These huddles will change shapes depending on the windspeed, where penguins on the exterior will move too the back causing the huddle to be more elongated.”)
print(“A tight huddle creates the shape of a hexagon, but will always be in motion due to changing wind speeds.”)
#If enthusiest
If sk == 1:
print(“For the experts: A Peclet number is a value that captures the effect of varying strength of wind and what that will do to the penguin huddle.”)
# Display a graph of the data on huddle thickness vs Péclet number, with an appropriate model fit to it. Provide a brief explanation of this model.

``````#Prompt the user to enter a Péclet number.

#Show the approximate predicted huddle shape, using graph_ellipse.

#Ask the user if they want to choose another Péclet number.
``````

#Print farewell message
print(“I hope you enjoyed learning about the unique environment that the emporer penguin survives in!”)

Well, a while loop is a perfect way to do that. You don’t say what’s not
working for you, or if you’re getting a syntax error, what you get.
Always cut/paste the error text, and a specific question. […]

Oh, you’ve pasted a small screenshot. Those f us using email don’t see
stuff like that, and anyway text is easy for us to read and cut/paste
ourselves.

Anyway, an assortment of remarks about the code:

Keywords like “while” and “if” are lowercase. You’ve got upper case
here, eg “While”. That’s your inital syntax error.

In Python, assignments use the single equals symbol and comparisons for
equality use the double character:

``````user = 1  # sets user to 1
while user == 1:  # test is user is equal to 1
``````

The function “print” also has a lowercase name. You’re using “Print”.

Variable names are generally lowercase (by convention) in Python. You’re
using “X” and “Y” - this is legal, just unconventional.

It looks to me like the month variable is the name of a month, which
will therefore be a string. Test like this:

``````if sk == 1 and month == "May":
``````

Notice the quotes around May, indicating that this is a string.
Otherwise Python expects a variable named May.

try these changes and see how far you get.

Cheers,
Cameron Simpson cs@cskk.id.au

Howdy Zara,

the python keyword “while” starts with a lowercase letter! You seem to have used an uppercase instead, which leads to a syntax error.

Cheers, Dominik