Professional Documents
Culture Documents
Lab 1 2 ML
Lab 1 2 ML
Lab 1 2 ML
Click Next
Click On I Agree
Click Next
Click Next
Click Install
Click Next
Click Next
Click Finish
Output
Explanation
This Python code asks the user for their name using the input() function, stores the entered name
in a variable called name, and then prints a welcome message that includes the user's name using
the print() function. It effectively greets the user with a personalized welcome message.
2 Write a program that prompts the user to input a Celsius temperature and
outputs the equivalent temperature in Fahrenheit.
Code
Output
Explanation
This Python code accepts a temperature in Celsius from the user, converts it to Fahrenheit using
the appropriate formula, and then displays the converted temperature in a user-friendly format with
one decimal place.
3 Write a program that accepts seconds from keyboard as integer. Your
program should converts seconds in hours, minutes and seconds.
Code
Output
Explanation
This Python code snippet takes a user-input number of seconds, converts it into hours, minutes,
and seconds, and then prints these converted values. It uses integer division and the modulo
operation to break down the total seconds into hours, minutes, and the remaining seconds. The
code then displays the calculated hours, minutes, and seconds to the user.
4 Write a program that prompts the user to enter number in two variables
and swap the contents of the variables.
Code
Output
Explanation
This program asks the user for two names, stores them in variables name and name2, and then
swaps their values using a temporary variable. It prints the original names and the names after the
swap.
5 Write a program that prompts the user to input the number and show table.
Code
Output
Explanation
In this program we uses a for loop to generate and print the multiplication table for the number
12. It iterates through the numbers from 1 to 10, calculating the product of 12 and each number in
the range and then printing the result in a formatted manner, such as "12 x 3 = 36". The program
does this for all values from 1 to 10, effectively displaying the multiplication table for 12.
Conclusion
In this Lab we learn about how to install the anaconda software and how to use this tool for python
language. We also do some programs these programs demonstrate a range of basic programming
concepts, including input/output, mathematical calculations, and variable manipulation. You can
adapt and use these programs for various purposes by replacing the provided inputs with your own
data or requirements.