Question

In: Computer Science

how to create file: vim hello<your name>.py print “Hello <your name>!” on ubuntu

how to create file: vim hello<your name>.py
print “Hello <your name>!” on ubuntu

Solutions

Expert Solution

There are two major versions of python.

  1. Python 2
  2. Python 3

In Python2, we use

  • print "Hello XYZ!"

In Python3, we use

  • print("Hello XYZ!") # We use the parenthesis

==============

PLEASE FOLLOW THE BELOW STEPS: { NOTE THAT YOU SHOULD REPLACE XYZ WITH YOUR NAME }

  1. IF YOU ARE USING PYTHON-2
    • Open terminal
    • Type vim helloXYZ.py
    • Now a file editor will be opened.
    • type i => i for insert
    • write print "Hello XYZ!" as shown
    • now write :wq
    • colon w q aithout any spaces
    • now run your program using python2 helloXYZ.py

2. IF YOU ARE USING PYTHON 3 {Just replace XYZ with your name}

  • Open terminal
  • Type vim helloXYZ.py
  • Now a file editor will be opened.
  • type i => i for insert
  • write print("Hello XYZ!") as shown # parenthesis added
  • now write :wq
  • colon w q aithout any spaces
  • now run your program using python3 helloXYZ.py # Python3

file data in python2

file data in python3


Related Solutions

Go to your “Documents” directory; a) Create a file “file1” with the text “hello” in it;...
Go to your “Documents” directory; a) Create a file “file1” with the text “hello” in it; Provide command and screenshot. b) Create a hard link named “file2” linked to “file1”; c) Create a soft link named “soft1” linked to “file1”; create another soft link named “soft2” linked to “file2”. d) View information of the 4 files (what command should you use to produce output) – how do you verify which file is a hard link and which file is a...
Hello, How can I make the program print out "Invalid data!!" if the file has a...
Hello, How can I make the program print out "Invalid data!!" if the file has a grade that is not an A, B, C, D, E, or F or a percentage below zero. The program should sort a file containing data about students like this for five columns: one for last name, one for first name, one for student ID, one for student grade percentage, one for student grade. Smith Kelly 438975 98.6 A Johnson Gus 210498 72.4 C Reges...
Open the terminal and using vi/vim create a new script and name it lab6 Insert at...
Open the terminal and using vi/vim create a new script and name it lab6 Insert at the top of your file a comment with your name, class and section number (e.g. #John Doe, EMT 2390L - OL123). In this lab you are going to display a multiplication table of a number entered by the user between 2 and 10 using a for loop and without using multiplication. The table will display the values that are less than or equal to...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is 2,...
python Create a new file name condition_quiz.py. Add a comment with your name and the date....
python Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is...
Create a geoprocessing tool from the .py file included (script from this file included below). Use...
Create a geoprocessing tool from the .py file included (script from this file included below). Use any csv file you would like. I will work around that. This is for a programming for GIS class. We work with jupyter, idle, arcgis pro import os import arcpy from arcpy import env input_table = r"C:\Answers\January2018.CSV" output_fc = r"C:\Answers\crime.gdb\January2018_Crime" spRef = arcpy.SpatialReference("NAD 1983 StatePlane Missouri East FIPS 2401 (US Feet)") gdb_name = os.path.dirname(output_fc) fc_name = os.path.basename(output_fc) env.overwriteOutput = True print("Creating File GDB") arcpy.CreateFileGDB_management(os.path.dirname(gdb_name),...
"""    CS 125 - Intro to Computer Science    File Name: CS125_Lab1.py    Python Programming...
"""    CS 125 - Intro to Computer Science    File Name: CS125_Lab1.py    Python Programming    Lab 1    Name 1: FirstName1 LastName1    Name 2: FirstName2 LastName2    Description: This file contains the Python source code for deal or no deal. """ class CS125_Lab1(): def __init__(self): # Welcome user to game print("Let's play DEAL OR NO DEAL")    # Define instance variables and init board self.cashPrizes = [.01, .50, 1, 5, 10, 50, 100, 250, 500, 1000, 5000,...
Using Python Shell 2.7, create a file called Assignment6_1.py Create an array based on a basic...
Using Python Shell 2.7, create a file called Assignment6_1.py Create an array based on a basic array Create a for loop that will print the array index the array, print out the index append an element to the array, print out the array insert an element into the array, print out the array pop an element from the array, print out the array remove an element from the array, print out the array reverse the order of the array, print...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create a variable named base_fee and set the value to 5.5. Prompt the user for the zone. The zones can be an integer value from 1 to any value for the zone. Convert the zone to an integer. Display the zone on the SenseHat with a scroll speed of 0.3, make the text blue, and the background yellow. Scroll "The zone is " and the...
Name your c++ file Word_LastNameFirstName.cpp. Create a struct that has a word and the length of...
Name your c++ file Word_LastNameFirstName.cpp. Create a struct that has a word and the length of the word. Next, use the struct to store the word read from a text file call “word.txt” and the length of the word. Print out the word x number of times based on the length of the word as shown below. Also, print a statement with the length and determine if the string length has an odd number or even number of characters. You...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT