1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Natali [406]
3 years ago
13

Python programming questions:

Computers and Technology
1 answer:
Aleksandr-060686 [28]3 years ago
7 0

Answer:

Following are the program in the Python Programming Language:

1.)

l=['Ruby','Dale','Kate']

n=input('Enter the name: ')

if(n in l):

   print('Hello {}'.format(n))

else:

   print('No {}'.format(n))

Output:

Enter the name: Dale

Hello Dale

2.)

file=open("text1.txt", "r+") #open file

str=file.read()  #read file

txt=str.replace('\n', ' ') #replace spaces

word=txt.split(' ') #split words in ' '

for words in word: #set for loop

   word2=' '

   for i in range(len(words)):  #set for loop

       if(words[i].isalpha()):  #set if statement

           word2 += words[i].lower()

   word[word.index(words)]=word2

while(' ' in word):  #set while loop

   word.remove(' ')  #remove spaces

st=set(word)

print('The ', len(st),' unique words which appears in document are ' \

     '(in no particular order): ')

for words in st:  #set for loop

   print('-', word)

file.close()  #close file

3.)

file=open("text1.txt", "r+") #open file

str=file.read()  #read file

txt=str.replace('\n', ' ') #replace spaces

word=txt.split(' ') #split words in ' '

for words in word: #set for loop

   word2=' '

   for i in range(len(words)):  #set for loop

       if(words[i].isalpha()):  #set if statement

           word2 += words[i].lower()

   word[word.index(words)]=word2

while(' ' in word):  #set while loop

   word.remove(' ')  #remove spaces

dic={}  #set dictionary

for words in word:  #set for loop

   if(words not in dic):  #set if statement

       dic[words]=1

   else:

       dic[words] +=1

print('\033[4m' + 'word   frequency' + '\033[0m')

for words in dic:

   print(format(words, '15s'), format(dic[words], '5d'))

file.close() #close file

Explanation:

1.) Here, we define the list data type variable 'l' then, set the variable 'n' and assign value by get input from the user,

  • we set if conditional statement and pass condition is that the variable 'n' is in the variable l then, print message.
  • otherwise, we print No message.

2.) Here, we define the variable "file" in which we open file and save that file in it.

Then, we set variable st which read the file then we set the variable in which we apply the replace().

Then. we set variable in which we split the by suing split()

2.) Here, we define the variable "file" in which we open file and save that file in it.

Then, we set variable st which read the file then we set the variable in which we apply the replace().

Then. we set variable in which we split the by suing split()

Then, we apply all that given in the question.

You might be interested in
Most job applications are online. true or false
Sonja [21]

Answer:

True

Explanation:

4 0
3 years ago
To make it easier to enter names into your code, NetBeans provides a feature known as
Alexus [3.1K]

Answer:

Code completion.

Explanation:

The NetBeans is an integrated development environment framework of java language. Code completion is the features of NetBeans which is easier to complete the code This feature is known as smart code features because it completes the code in a very easy manner. The Code completion features are needful when we have to fill the missing code or program in the java language.  

Hence Code completion.  is used to enter the name into the code in the  NetBeans.

3 0
3 years ago
WHAT IS SQL AND HOW CAN YOU MEET THE DATA REQUIREMENTS ALSO MAINTAINING DATA INTEGRITY,AND LASTLY STATE THE FULL MEANING OF SQL
castortr0y [4]
SQL stands for Structured Query Language, it is a standard query language that is used in a computer usually used for manipulation of data in a system through its database management by using its query codes or commands. It is widely used in database management and manipulation because it use a CRUD query method or Create, Update, Delete and Insert of data in the database.
5 0
4 years ago
Which ipv4 ip class provides for 126 unique networks, each having up to 16,777,214 hosts?
Sliva [168]
Class A.






----------------------------------------
3 0
3 years ago
How would you share information and communicate news and events​
MariettaO [177]

Answer:

You could use Print things (mail, books, etc.) or Online things (internet, social media, etc.)

Hope this helps :)

4 0
4 years ago
Other questions:
  • Examples of environmental technology and good and bad impacts
    13·1 answer
  • Emily wants to search online for cakes containing nuts. However, she wants to skip cakes that have raisins in them. Which option
    9·1 answer
  • What is ATX full size motherboard? Tell its size as well?
    14·1 answer
  • Assume that there is a class called BankAccountHolder that represents an individual member of a bank. There is also a BankAccoun
    5·2 answers
  • 1.  
    15·1 answer
  • The following code in a different program is not working properly.The message should display the value of the intCounter variabl
    11·1 answer
  • I really need help with this question, I can’t fail this please :) tysm
    10·1 answer
  • A palindrome is a string that reads the same from left to right and from right to left. Design an algorithm to find the minimum
    15·1 answer
  • Computer are most wonderful creation of 21st century how ?​
    15·1 answer
  • The. Model has the disadvantage of high project cost due to creation several prototypes
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!