What is Python?

by Tripxxlt · 4 posts
2 years ago
Posted 2 years ago · Author
Explain Python and how to use it please asap
Posted 2 years ago
# Print Statements name = input("Enter your name: ") '''Takes input from user and stores into variable: name''' age = input("Enter your age: ") '''Takes input from user and stores into variable: age''' print("Hello " + name + "! You are " + age + ".") '''Prints using input information''' 

# Simple Calculations num1 = input("Enter the first number: ") num2 = input("Enter the second number: ") result = int(num1) + float(num2) '''Input from users in python are automatically converted to strings. In order to add the numbers we need to convert the strings to numbers. One thing we can do is result = int(num1) + int(num2).  Remember that int is just for whole number.  If your input number contains a decimal, we must use float.''' print(result)

# If Statements  is_male = True is_tall = False '''Boolean variable set to true''' if is_male:     print("You are a male.") '''it wouldn't have printed anything if is male was set to false.'''

 if is_male:     print("You're a male.") else:     print("You're not a male.")
if is_male or is_tall:     print("You're a male or tall or both.") else:     print("You're neither male nor tall")
if is_male and is_tall:     print("You're a male and tall.") elif is_male and not(is_tall):     print("You're a short male.") elif not(is_male) and is_tall:     print("You're a short but not a male.") else:     print("You're either not male or not tall or both.")

# While loop i = 1 while i <= 10:     print(i)     i = i + 1     '''short hand for i = i + 1 is i += 1 in python'''
print("Done with loop."

# For Loops
for letter in "sammy":     print(letter)
'''For each letter in sammy I want to print out a letter. This prints out all the letters in the name.'''
friends = ["Jim", "Karen", "Pam"] for name in friends:     print(name)
for index in range(3, 10):     print(index) '''prints numbers 3 - 10'''
for index in range(len(friends)):     print(friends[index]) '''len(friends) = 3 so it prints out 0, 1, 2 values.'''
Posted 2 years ago
i love to know more about python. thanks for posted this video .

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here


Create an account

Sign up for a new account in our community. It's easy!

Select a forum Protection     Help & Support     Introductions     Mafia News     IMVU News General Discussion     IMVU Lounge        IMVU Series / Roleplaying        Social Games     Mafia Market     Mafia Tools        Premium IMVU Tools        Off Topic Tools     Off Topic     Contests Creator Corner     Graphics Design        Photoshop        GIMP     Basic Creator Help     Catalog And Product Showcase     3D Meshing        3Ds Max        Sketchup        Blender Gangsters with Connections     White Hat Activities        Google Hacking        Trackers Programming Corner     Coding        Python        .Net (C#, VB, etc)        Flash        JAVA        Autoit        Batch        HTML & CSS        Javascript        PHP        Other        IMVU Homepage Codes           General           About me Panel           Messages Panel           Special Someone Panel           Visitors Panel           New Products Panel           Rankings Panel           Wishlist Panel           My Badges Panel           Outfits Panel           Url Panel           Groups Panel           Slideshow Panel           My Room Panel           Sandbox panel           Layouts     Help & Requests Free Credits     Approved Methods     Submit Methods Free Money     Approved Methods     Submit Methods Adult Corner     Get Mafia AP Here     AP Lounge        AP Social Games        Casual Dating Tips     IMVU Slave Market & Escorts