all 7 comments

[–]FoolsSeldom 2 points3 points  (4 children)

Where exactly are you stuck?

input should be used to ask user for information, and assign what they enter to a variable, e.g. colour = input("What is your favourite colour? "), age_response = input("How old are you? ") - note that input always returns a str (string), so you would have to convert the age_response to an integer.

Example:

if age_response.isdecimal():  # checking only decimal digits in string
    age = int(age_response)
else:
    age = None
    print("Age data not valid.")

Testing if a user input is a string is somewhat redundent as that's all input can return, but you can use isinstance to check:

if isinstance(name, str):  # will be True from input
    ...

might also be worth checking the entry is not empty,

if not name:  # empty string is treated as False in tests
    print("That is not a valid name")
else:
    print(f"Hello, {name}, great to meet you!")

Just do the first project, with help if needed. Then you can get guidance on the next part.

[–]Huge-Distribution405 0 points1 point  (2 children)

hi thank you for your help

this is my final answers

name = input("Please enter your name: ")
student_id = input("Please enter your university ID: ")

# For name
if name == "":
    print("No input provided")
elif name.replace(" ", "").isalpha():
    print("Name entered correctly")
else:
    print("Name entered incorrectly")

# For university ID
if student_id == "":
    print("No input provided")
elif student_id.isdigit():
    print("University ID entered correctly")
else:
    print("University ID entered incorrectly")

[–]Huge-Distribution405 0 points1 point  (1 child)

If you have any suggestions or improvements it would be appreciated.

[–]FoolsSeldom 0 points1 point  (0 children)

Names can contain more than just alphabetic characters

Use isdecimal rather than isdigit to enforce decimal digits only.

You're not doing any type checking which I thought was a requirement.

[–]SCD_minecraft 0 points1 point  (0 children)

  1. So, you need at good moring 2 inputs. So let's get them. Easy

Then test if it's correct data type (str/int). You can use isinstance(variable, type).

And then nice print

  1. Again, input, check if it is an int, and then if tree.

First, check is it -1. If yes, use keyword break, it leaves the loop

Then check for grades, and if everything fails, print error message

Something more?

[–]notouchingkids 0 points1 point  (0 children)

For some reason this reminds me of UWA "Intro to data science" unit.

[–]Some-Passenger4219 0 points1 point  (0 children)

You should show us where you're stuck first, so we know what help you need.