How to Create a Very Simple Program in Python

Open up a new window in python shell by pressing ctrl-N or going to 'File' and 'New window'., You need an introductory sentence., It's nice to know what the user's name is, so type this in line 2: name = input("name: ") The variable "name" has now...

11 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Open up a new window in python shell by pressing ctrl-N or going to 'File' and 'New window'.

    So you have to use the print function. Type below codes: print("Let's see how long you have lived in days, minutes and seconds.") ,,, days = age * 365 minutes = age * 525948 seconds = age * 31556926 Once you have wrote this, python automatically changes the values for days, minutes, and seconds, based on the user's input of age. , print(name, "has been alive for"

    days,"days"

    minutes, "minutes and"

    seconds, "seconds! Wow!") , you made a real program that serves a purpose! Save it and run it by going to 'run' and 'run module'.

    Try it out for yourself!
  2. Step 2: You need an introductory sentence.

  3. Step 3: It's nice to know what the user's name is

  4. Step 4: so type this in line 2: name = input("name: ") The variable "name" has now been replaced by the user's input.

  5. Step 5: You need to know the age

  6. Step 6: now you do the same thing as above except you have to use the "int" function

  7. Step 7: because the user will enter a number

  8. Step 8: like this: print("now enter your age") age = int(input("age: ")) The variable "age" has now been replaced by the user's input.

  9. Step 9: You need to do the conversions using the user's given age.

  10. Step 10: It's time to display to the user his/her information.

  11. Step 11: Congrats!

Detailed Guide

So you have to use the print function. Type below codes: print("Let's see how long you have lived in days, minutes and seconds.") ,,, days = age * 365 minutes = age * 525948 seconds = age * 31556926 Once you have wrote this, python automatically changes the values for days, minutes, and seconds, based on the user's input of age. , print(name, "has been alive for"

days,"days"

minutes, "minutes and"

seconds, "seconds! Wow!") , you made a real program that serves a purpose! Save it and run it by going to 'run' and 'run module'.

Try it out for yourself!

About the Author

J

Jessica Turner

A passionate writer with expertise in hobbies topics. Loves sharing practical knowledge.

65 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: