27 Nov Aurora Monday 18:30 Python Homework 20.11.23.
Question 1.
Use float() to create a number from a string like ‘12.34’. Make sure the result is really a number!
Question 2.
Try using int() to create an integer from a decimal number like 56.78. Did the answer get rounded up or down?
Question 3.
Try using int() to create an integer from a string. Make sure the result is really an integer!
You could create python file and Write program for question 4, detailed instructions as below:
- Open Python IDLE
- In Menu Bar, Click “File” => “New File”
- In the file write your program
- After finishing writing the program, click “Run”=>”Run Module” in menu bar or just press “F5”
- Python will ask you save the file before run the program
- Check your code and fix the errors.
Question 4.
Write a program that asks for your first name, then asks for your last name, and then prints a message with your first and last names in it.
Hint:
Use input() to ask question and get answer, for example:
firstName = input("What is your first name?")
The string answer as value will be assigned to variable firstName.
Sorry, the comment form is closed at this time.